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
Welcome to Scala version 2.10.3 (JavaHotSpot(TM) 64-BitServerVM, Java1.7.0_45).
Type in expressions to have them evaluated.
Type:help for more information.
scala>caseclassPrivateConstructorValprivate (valunderlying:String) extendsAnyVal
defined classPrivateConstructorVal
scala>caseclassProtectedConstructorValprotected (valunderlying:String) extendsAnyVal
defined classProtectedConstructorVal
scala>caseclassPrivateConstructorRefprivate (valunderlying:String)
defined classPrivateConstructorRef
scala>caseclassProtectedConstructorRefprotected (valunderlying:String)
defined classProtectedConstructorRef
scala>PrivateConstructorVal("")
res0:PrivateConstructorVal=PrivateConstructorVal()
scala>ProtectedConstructorVal("")
<console>:10:error: constructor ProtectedConstructorVal in classProtectedConstructorVal cannot be accessed in object$iwAccess to protected constructor ProtectedConstructorVal not permitted because
enclosing object$iw is not a subclass of
classProtectedConstructorVal where target is defined
ProtectedConstructorVal("")
^
scala>PrivateConstructorRef("")
res2:PrivateConstructorRef=PrivateConstructorRef()
scala>ProtectedConstructorRef("")
<console>:10:error: constructor ProtectedConstructorRef in classProtectedConstructorRef cannot be accessed in object$iwAccess to protected constructor ProtectedConstructorRef not permitted because
enclosing object$iw is not a subclass of
classProtectedConstructorRef where target is defined
ProtectedConstructorRef("")
^
I don't know which behavior is correct, but I guess they could behave the same.
The text was updated successfully, but these errors were encountered:
➜ snips cat t8491.scala
case class V private (s: String) extends AnyVal
case class W protected (s: String) extends AnyVal
case class X private (s: String)
case class Y protected (s: String)
object Test extends App {
println {(
V("v"),
W("w"),
X("x"),
Y("y")
)}
}
➜ snips scalac -d /tmp t8491.scala
t8491.scala:10: error: constructor W in class W cannot be accessed in object Test
Access to protected constructor W not permitted because
enclosing object Test is not a subclass of
class W where target is defined
W("w"),
^
t8491.scala:11: error: constructor X in class X cannot be accessed in object Test
X("x"),
^
t8491.scala:12: error: constructor Y in class Y cannot be accessed in object Test
Access to protected constructor Y not permitted because
enclosing object Test is not a subclass of
class Y where target is defined
Y("y")
^
three errors found
➜ snips scalac -version
Scala compiler version 2.10.7 -- Copyright 2002-2017, LAMP/EPFL
This was also then:
➜ snips sdk use scala 2.11.12
Using scala version 2.11.12 in this shell.
➜ snips scalac -d /tmp t8491.scala
➜ snips
This is now:
➜ snips sdk use scala 3.1.1
Using scala version 3.1.1 in this shell.
➜ snips scalac -d /tmp t8491.scala
-- Error: t8491.scala:9:4 ----------------------------------------------------------------------------------------------
9 | V("v"),
| ^
| method apply cannot be accessed as a member of V.type from module class Test$.
-- Error: t8491.scala:11:4 ---------------------------------------------------------------------------------------------
11 | X("x"),
| ^
| method apply cannot be accessed as a member of X.type from module class Test$.
2 errors found
➜ snips
This is also now:
➜ snips sdk use scala 2.13.8
Using scala version 2.13.8 in this shell.
➜ snips scalac -Xsource:3 -d /tmp t8491.scala
t8491.scala:9: error: method apply in object V cannot be accessed as a member of object V from object Test
error after rewriting to V.<apply: error>
possible cause: maybe a wrong Dynamic method signature?
V("v"),
^
t8491.scala:11: error: method apply in object X cannot be accessed as a member of object X from object Test
error after rewriting to X.<apply: error>
possible cause: maybe a wrong Dynamic method signature?
X("x"),
^
2 errors
I don't know which behavior is correct, but I guess they could behave the same.
The text was updated successfully, but these errors were encountered: