Skip to content

Commit

Permalink
Fix reflect.LambdaType type test
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Feb 21, 2023
1 parent 1821107 commit 4386f3f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2167,11 +2167,11 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
end extension
end PolyTypeMethods

type TypeLambda = dotc.core.Types.TypeLambda
type TypeLambda = dotc.core.Types.HKTypeLambda

object TypeLambdaTypeTest extends TypeTest[TypeRepr, TypeLambda]:
def unapply(x: TypeRepr): Option[TypeLambda & x.type] = x match
case tpe: (Types.TypeLambda & x.type) => Some(tpe)
case tpe: (Types.HKTypeLambda & x.type) => Some(tpe)
case _ => None
end TypeLambdaTypeTest

Expand Down
4 changes: 2 additions & 2 deletions scaladoc/src/dotty/tools/scaladoc/tasty/TypesSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,10 @@ trait TypesSupport:
}
inner(sc) ++ keyword(" match ").l ++ plain("{\n").l ++ casesTexts ++ plain(spaces + "}").l

case ParamRef(TypeLambda(names, _, _), i) => tpe(names.apply(i)).l

case ParamRef(m: MethodType, i) => tpe(m.paramNames(i)).l ++ plain(".type").l

case ParamRef(binder: LambdaType, i) => tpe(binder.paramNames(i)).l

case RecursiveType(tp) => inner(tp)

case MatchCase(pattern, rhs) =>
Expand Down
10 changes: 10 additions & 0 deletions tests/pos-macros/i16961/Macro_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import scala.quoted.*

inline def myMacro = ${ myMacroImpl }

def myMacroImpl(using Quotes) =
import quotes.reflect.*

PolyType(List("arg"))(_ => List(TypeBounds.empty), _ => TypeRepr.of[Any]) match
case _: TypeLambda => quotes.reflect.report.errorAndAbort("PolyType should not be a TypeLambda")
case _ => '{ () } // Ok
1 change: 1 addition & 0 deletions tests/pos-macros/i16961/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def test = myMacro

0 comments on commit 4386f3f

Please sign in to comment.