Skip to content

Commit 73ecde2

Browse files
committed
Also count @Sealed annotated abstract types as sealed
Also count abstract types that have a @Sealed annotation on their bound as sealed. That way, we get free propagation into synthesized type parameters. We should probably unify this scheme and `sealed` modifiers.
1 parent 2dd9b70 commit 73ecde2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ object CheckCaptures:
163163
capt.println(i"disallow $t, $tp, $what, ${t.symbol.is(Sealed)}")
164164
t.info match
165165
case TypeBounds(_, hi)
166-
if !t.symbol.is(Sealed) && !t.symbol.isParametricIn(carrier) =>
166+
if !t.symbol.is(Sealed) && !hi.hasAnnotation(defn.Caps_SealedAnnot)
167+
&& !t.symbol.isParametricIn(carrier) =>
167168
if hi.isAny then
168169
report.error(
169170
em"""$what cannot $have $tp since

0 commit comments

Comments
 (0)