File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -378,6 +378,8 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
378378 else (tree.rhs, sym.info) match
379379 case (rhs : LambdaTypeTree , bounds : TypeBounds ) =>
380380 VarianceChecker .checkLambda(rhs, bounds)
381+ if sym.isOpaqueAlias then
382+ VarianceChecker .checkLambda(rhs, TypeBounds .upper(sym.opaqueAlias))
381383 case _ =>
382384 processMemberDef(super .transform(tree))
383385 case tree : New if isCheckable(tree) =>
Original file line number Diff line number Diff line change 1+ opaque type CovariantArray [+ A ] = Array [A ] // error
2+
3+ object CovariantArray :
4+ def crash () =
5+ val stringArray : CovariantArray [String ] = Array (" foo" , " bar" )
6+ val anyArray : CovariantArray [Any ] = stringArray
7+ anyArray(0 ) = 42
8+ stringArray(0 ).length
9+
10+ @ main def Test = CovariantArray .crash()
You can’t perform that action at this time.
0 commit comments