You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ dotr
Starting dotty REPL...
scala>classC { protectedvalc=42 }
// defined class C
scala>valx=C() ; x.c
1|valx=C() ; x.c
|^^^|value c in classC cannot be accessed asa member of C(x) from module classrs$line$2$.
|Access to protected value c not permitted because enclosing objectrs$line$2| is not a subclass of classC 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.
The text was updated successfully, but these errors were encountered:
I think for error messages, it makes sense to just print C and disregard that we're actually dealing with a singleton subtype of that type. I don't think I ever saw an error message where the fact that the type was a singleton was relevant.
I was less confused when I understood that it was actually the familiar Int(42) notation. But people also ask for diagnostics or REPL output printed in a form they can paste. This change looks good. Of course, all dotty diagnostics look good compared side-by-side with scala 2.
minimized code
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.The text was updated successfully, but these errors were encountered: