Skip to content

Commit f70b899

Browse files
committed
Avoid double @unchecked annotation
Avoid double @unchecked annotation if selector is marked checkIrrefutable.
1 parent 7ed0041 commit f70b899

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
@@ -1599,7 +1599,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
15991599
result match {
16001600
case result @ Match(sel, CaseDef(pat, _, _) :: _) =>
16011601
tree.selector.removeAttachment(desugar.CheckIrrefutable) match {
1602-
case Some(checkMode) =>
1602+
case Some(checkMode) if !sel.tpe.hasAnnotation(defn.UncheckedAnnot) =>
16031603
val isPatDef = checkMode == desugar.MatchCheck.IrrefutablePatDef
16041604
if (!checkIrrefutable(sel, pat, isPatDef) && sourceVersion == `future-migration`)
16051605
if (isPatDef) patch(Span(tree.selector.span.end), ": @unchecked")

0 commit comments

Comments
 (0)