Skip to content

Commit 913bc49

Browse files
committed
Check well-formedness of @retains only under -Ycc
1 parent 21bbc6e commit 913bc49

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2675,7 +2675,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
26752675
val arg1 = typed(tree.arg, pt)
26762676
if (ctx.mode is Mode.Type) {
26772677
val cls = annot1.symbol.maybeOwner
2678-
if cls == defn.RetainsAnnot || cls == defn.RetainsByNameAnnot then
2678+
if ctx.settings.Ycc.value
2679+
&& (cls == defn.RetainsAnnot || cls == defn.RetainsByNameAnnot)
2680+
then
26792681
CheckCaptures.checkWellformed(annot1)
26802682
if arg1.isType then
26812683
assignType(cpy.Annotated(tree)(arg1, annot1), arg1, annot1)

0 commit comments

Comments
 (0)