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
Variant 1 - a local case object, which doesn't result in a runtime failure but we actually get a new instance of a singleton
// usage.scala@main defmain= {
caseobjectWhatevervalwhatever:Whatever.type=InvokeConstructor[Whatever.type]
println(whatever eq Whatever) // evaluates to false
println(whatever ==Whatever) // evaluates to false
}
Variant 2 - a toplevel case object, this results in a runtime error
caseobjectWhatever/*fails at runtime:Exception in thread "main" java.lang.IllegalAccessError: class Usage$package$ tried to access private method 'void Whatever$.<init>()' (Usage$package$ and Whatever$ are in unnamed module of loader 'app') at Usage$package$.main(Usage.scala:5) at main.main(Usage.scala:3)*/@main defmain= {
valwhatever:Whatever.type=InvokeConstructor[Whatever.type]
}
Expectation
Compilation failure.
The text was updated successfully, but these errors were encountered:
Compiler version
3.2.2, 3.3.0-RC6
Minimized code
Variant 1 - a local case object, which doesn't result in a runtime failure but we actually get a new instance of a singleton
Variant 2 - a toplevel case object, this results in a runtime error
Expectation
Compilation failure.
The text was updated successfully, but these errors were encountered: