Skip to content

Commit fdc9c07

Browse files
committed
Fix bug with QuotePatterns::checkPattern
1 parent 3d6fb49 commit fdc9c07

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/src/dotty/tools/dotc/quoted/QuotePatterns.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@ object QuotePatterns:
7676
new tpd.TreeTraverser {
7777
override def traverse(tree: tpd.Tree)(using Context): Unit = tree match {
7878
case tree: SplicePattern =>
79-
def uncapturedTypeVars(arg: tpd.Tree, capturedTypeVars: List[tpd.Tree]) =
79+
def uncapturedTypeVars(arg: tpd.Tree, capturedTypeVars: List[tpd.Tree]): Set[Type] =
80+
/* Sometimes arg is untyped when a splice pattern is ill-formed.
81+
* Return early in such case.
82+
* Refer to QuoteAndSplices::typedSplicePattern
83+
*/
84+
if !arg.hasType then return Set.empty
85+
8086
val capturedTypeVarsSet = capturedTypeVars.map(_.symbol).toSet
8187
new TypeAccumulator[Set[Type]] {
8288
def apply(x: Set[Type], tp: Type): Set[Type] =

0 commit comments

Comments
 (0)