Skip to content

Commit 9b737d0

Browse files
committed
Fix TypeIdentTypeTest and WildcardTypeTreeTypeTest
`TypeIdentTypeTest` would accidentally match `WildcardTypeTree` and `WildcardTypeTreeTypeTest` would accidentally match term `Ident(_)`
1 parent 56b3834 commit 9b737d0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
10221022

10231023
object TypeIdentTypeTest extends TypeTest[Tree, TypeIdent]:
10241024
def unapply(x: Tree): Option[TypeIdent & x.type] = x match
1025-
case tpt: (tpd.Ident & x.type) if tpt.isType => Some(tpt)
1025+
case tpt: (tpd.Ident & x.type) if tpt.isType && tpt.name != nme.WILDCARD => Some(tpt)
10261026
case _ => None
10271027
end TypeIdentTypeTest
10281028

@@ -1336,7 +1336,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
13361336

13371337
object WildcardTypeTreeTypeTest extends TypeTest[Tree, WildcardTypeTree]:
13381338
def unapply(x: Tree): Option[WildcardTypeTree & x.type] = x match
1339-
case x: (tpd.Ident & x.type) if x.name == nme.WILDCARD => Some(x)
1339+
case x: (tpd.Ident & x.type) if x.isType && x.name == nme.WILDCARD => Some(x)
13401340
case _ => None
13411341
end WildcardTypeTreeTypeTest
13421342

0 commit comments

Comments
 (0)