File tree 3 files changed +17
-1
lines changed
compiler/src/dotty/tools/dotc/typer
3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -989,7 +989,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
989
989
990
990
def canAssign (sym : Symbol ) =
991
991
sym.is(Mutable , butNot = Accessor ) ||
992
- ctx.owner.isPrimaryConstructor && ! sym.is(Method ) && sym.owner == ctx.owner.owner ||
992
+ ctx.owner.isPrimaryConstructor && ! sym.is(Method ) && sym.maybeOwner == ctx.owner.owner ||
993
993
// allow assignments from the primary constructor to class fields
994
994
ctx.owner.name.is(TraitSetterName ) || ctx.owner.isStaticConstructor
995
995
Original file line number Diff line number Diff line change
1
+ object O {
2
+ class AC (code : => Unit )
3
+
4
+ val action = new AC ({mode = ??? }) {} // error
5
+
6
+ def mode : AnyRef = ???
7
+ def mode = (em : AnyRef ): Unit = {} // error // error // error
8
+ }
Original file line number Diff line number Diff line change
1
+ object O {
2
+ class AC (code : => Unit )
3
+
4
+ val action = new AC ({mode = ??? }) {}
5
+
6
+ def mode : AnyRef = ???
7
+ def mode_= (em : AnyRef ): Unit = {}
8
+ }
You can’t perform that action at this time.
0 commit comments