Skip to content

Commit 09a73dc

Browse files
Fix splice type variable pattern detection (#17048)
Fixes #17039
2 parents 49215aa + 0a1ceb9 commit 09a73dc

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
@@ -250,7 +250,7 @@ trait QuotesAndSplices {
250250
val pat1 = if (patType eq patType1) pat else pat.withType(patType1)
251251
patBuf += pat1
252252
}
253-
case Select(pat, _) if tree.symbol.isTypeSplice =>
253+
case Select(pat: Bind, _) if tree.symbol.isTypeSplice =>
254254
val sym = tree.tpe.dealias.typeSymbol
255255
if sym.exists then
256256
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)