Skip to content

Commit 0a1ceb9

Browse files
committed
Fix splice type variable pattern detection
Fixes #17039
1 parent ce65296 commit 0a1ceb9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ trait QuotesAndSplices {
249249
val pat1 = if (patType eq patType1) pat else pat.withType(patType1)
250250
patBuf += pat1
251251
}
252-
case Select(pat, _) if tree.symbol.isTypeSplice =>
252+
case Select(pat: Bind, _) if tree.symbol.isTypeSplice =>
253253
val sym = tree.tpe.dealias.typeSymbol
254254
if sym.exists then
255255
val tdef = TypeDef(sym.asType).withSpan(sym.span)

tests/pos-macros/i17039.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import scala.quoted.*
2+
3+
def macroImpl(using Quotes) =
4+
val t = summon[Type[Int]]
5+
Type.of[Int] match
6+
case '[t.Underlying] => '{true}
7+
case _ => '{false}

0 commit comments

Comments
 (0)