Skip to content

Commit 0a8f763

Browse files
committed
Use InferredTypeTree for @unchecked match selectors
Without this, we get stray capture sets in match selectors if the match is not exhaustive.
1 parent 4b812e3 commit 0a8f763

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1829,7 +1829,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
18291829
// TODO: move the check above to patternMatcher phase
18301830
val uncheckedTpe = AnnotatedType(sel.tpe.widen, Annotation(defn.UncheckedAnnot, tree.selector.span))
18311831
tpd.cpy.Match(result)(
1832-
selector = tpd.Typed(sel, tpd.TypeTree(uncheckedTpe)),
1832+
selector = tpd.Typed(sel, new tpd.InferredTypeTree().withType(uncheckedTpe)),
18331833
cases = result.cases
18341834
)
18351835
case _ =>

0 commit comments

Comments
 (0)