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
classAccessPrivateConstructor {
newPrivateConstructor("") // Scalac should forbid accessing to the private constructor!
}
Run scalac:
scalac AccessPrivateConstructor.scala
I expect scalac to print some compilation error, but scalac does not print any thing. Scalac just ignores the private modifier for constructor when parsing PrivateConstructor.class.
The text was updated successfully, but these errors were encountered:
@retronym said:
Reopening: the remedy was far worse than the disease:
~/code/scala cat sandbox/test.scala
classVprivate (vala:Any) extendsAnyVal~/code/scala RUNNER=scalac scala-hash b07228aebe sandbox/test.scala
[info] b07228aebe =>/Users/jason/usr/scala-v2.10.0-256-gb07228a
~/code/scala scala-hash b07228aebe
[info] b07228aebe =>/Users/jason/usr/scala-v2.10.0-256-gb07228a
Welcome to Scala version 2.10.1-20130116-230935-b07228aebe (JavaHotSpot(TM) 64-BitServerVM, Java1.6.0_27).
Type in expressions to have them evaluated.
Type:help for more information.
scala>deffoo(v: V) = v.a == v.a
exception when typing v.a().==(v.a())/classscala.reflect.internal.Trees$Apply
constructor V in classV cannot be accessed in object$iw in file <console>
scala.reflect.internal.Types$TypeError: constructor V in classV cannot be accessed in object$iw
PrivateConstructor.scala
:scalac PrivateConstructor.scala
AccessPrivateConstructor.scala
:scalac AccessPrivateConstructor.scala
I expect scalac to print some compilation error, but scalac does not print any thing. Scalac just ignores the private modifier for constructor when parsing
PrivateConstructor.class
.The text was updated successfully, but these errors were encountered: