File tree Expand file tree Collapse file tree 2 files changed +39
-7
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 2 files changed +39
-7
lines changed Original file line number Diff line number Diff line change @@ -826,14 +826,19 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
826
826
*/
827
827
def becomes (rhs : Tree )(implicit ctx : Context ): Tree =
828
828
if (tree.symbol is Method ) {
829
- val setr = tree match {
830
- case Ident (_) =>
831
- val setter = tree.symbol.setter
832
- assert(setter.exists, tree.symbol.showLocated)
833
- ref(tree.symbol.setter)
834
- case Select (qual, _) => qual.select(tree.symbol.setter)
829
+ val setter = tree.symbol.setter
830
+ assert(setter.exists, tree.symbol.showLocated)
831
+ val qual = tree match {
832
+ case id : Ident =>
833
+ id.tpe match {
834
+ case TermRef (prefix : TermRef , _) =>
835
+ ref(prefix)
836
+ case TermRef (prefix : ThisType , _) =>
837
+ This (prefix.cls)
838
+ }
839
+ case Select (qual, _) => qual
835
840
}
836
- setr .appliedTo(rhs)
841
+ qual.select(setter) .appliedTo(rhs)
837
842
}
838
843
else Assign (tree, rhs)
839
844
Original file line number Diff line number Diff line change
1
+ class A {
2
+ var a = false
3
+ }
4
+
5
+ object B {
6
+ var b = false
7
+ }
8
+
9
+ class C {
10
+ var c = false
11
+ }
12
+
13
+ object C extends A {
14
+ def test = {
15
+ a = true
16
+ C .a = true
17
+ this .a = true
18
+ C .this .a = true
19
+
20
+ import B ._
21
+ b = true
22
+
23
+ val c0 = new C
24
+ import c0 ._
25
+ c = true
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments