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
caseclassConfig(_config: String)
abstractclassFoo(valconfig:Config) {
defthis(config: String) = {
this(Config(config))
}
}
classBar(config: String) extendsFoo(config) {
deffoo():Unit= {
config.getClass()
}
}
newBar("").foo() //This line will crash in prod
Output
Caused by: java.lang.ClassCastException: class Playground$Config cannot be cast to class java.lang.String (Playground$Config is in unnamed module of loader sbt.internal.BottomClassLoader @11415fc3; java.lang.String is in module java.base of loader 'bootstrap')
at Playground$Bar.config$accessor(main.scala:11)
at Playground$Bar.foo(main.scala:13)
at Playground$.<clinit>(main.scala:17)
Expectation
That code compiles and runs without crashing (like in scala 2.13)