Skip to content

Commit

Permalink
Fix reflect.LambdaType type test
Browse files Browse the repository at this point in the history
Fixes #16961
  • Loading branch information
nicolasstucki committed Feb 20, 2023
1 parent 769ca3b commit a32af5e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 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
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 a32af5e

Please sign in to comment.