Closed
Description
minimized code
$ dotr
Starting dotty REPL...
scala> class C { protected val c = 42 }
// defined class C
scala> val x = C() ; x.c
1 |val x = C() ; x.c
| ^^^
|value c in class C cannot be accessed as a member of C(x) from module class rs$line$2$.
| Access to protected value c not permitted because enclosing object rs$line$2
| is not a subclass of class C where target is defined
expectation
As a confused beginner, instead of as a member of C(x)
, I expect a phrase such as, as a member of type C referenced as value x
. Obviously, that is unwieldy.
With the new new
-less style, C(x)
really looks like a constructor invocation.