File tree 1 file changed +7
-2
lines changed
compiler/src/dotty/tools/dotc/typer
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -587,8 +587,13 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
587
587
lhsCore.tpe match {
588
588
case ref : TermRef =>
589
589
val lhsVal = lhsCore.denot.suchThat(! _.is(Method ))
590
- if (canAssign(lhsVal.symbol))
591
- assignType(cpy.Assign (tree)(lhs1, typed(tree.rhs, lhsVal.info)))
590
+ if (canAssign(lhsVal.symbol)) {
591
+ // lhsBounds: (T .. Any) as seen from lhs prefix, where T is the type of lhsVal.symbol
592
+ // This ensures we do the as-seen-from on T with variance -1. Test case neg/i2928.scala
593
+ val lhsBounds =
594
+ TypeBounds .lower(lhsVal.symbol.info).asSeenFrom(ref.prefix, lhsVal.symbol.owner)
595
+ assignType(cpy.Assign (tree)(lhs1, typed(tree.rhs, lhsBounds.loBound)))
596
+ }
592
597
else {
593
598
val pre = ref.prefix
594
599
val setterName = ref.name.setterName
You can’t perform that action at this time.
0 commit comments