File tree 2 files changed +6
-5
lines changed
src/dotty/tools/dotc/typer 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -396,10 +396,11 @@ class Typer extends Namer
396
396
}
397
397
else if (name.toTermName == nme.ERROR )
398
398
UnspecifiedErrorType
399
- else if (ctx.owner.isConstructor && ctx.owner.owner.unforcedDecls.lookup(tree.name).exists) {
400
- // If the field existed but was not found we assume that
401
- // we where in the context of an argument of the super constructor
402
- errorType(ex " $tree is not accessible from super constructor arguments " , tree.pos)
399
+ else if (ctx.owner.isConstructor && ctx.mode.is(Mode .InSuperCall ) &&
400
+ ctx.owner.owner.unforcedDecls.lookup(tree.name).exists) {
401
+ // When InSuperCall mode and in a constructor we are in the arguments
402
+ // of a this(...) constructor call
403
+ errorType(ex " $tree is not accessible from constructor arguments " , tree.pos)
403
404
} else
404
405
errorType(new MissingIdent (tree, kind, name.show), tree.pos)
405
406
Original file line number Diff line number Diff line change 1
1
scala> class Foo(x : Any) { val foo : Integer = 0; def this() = { this(foo) } }
2
2
1 | class Foo(x : Any) { val foo : Integer = 0; def this() = { this(foo) } }
3
3
| ^^^
4
- | foo is not accessible from super constructor arguments
4
+ | foo is not accessible from constructor arguments
You can’t perform that action at this time.
0 commit comments