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
packagebugpackageobjecttesting {
typeFoo=String// alternatives:// trait Foo extends Serializable// type Foo <: StringobjectFoo
}
objectTest {
defmain(args: Array[String]):Unit= {
// This should not display scala.Serializable
println(testing.Foo.getClass.getInterfaces().mkString(", "))
// This should not even compile:
println(testing.Foo:Serializable)
}
}
This can be particularly annoying in Scala.js, because it makes it impossible to declare a type alias whose companion is a JavaScript type (since JavaScript types cannot extend non-JS types such as Serializable). See scala-js/scala-js#2244 (comment)
The text was updated successfully, but these errors were encountered:
I see the linked PR was demonstrating that the example:
scalac t9668.scala && scala Test
t9668.scala:16: error: type mismatch;
found : testing.Foo.type
required: Serializable
println(testing.Foo: Serializable)
^
one error found
File
Test.scala
:Compile and run:
This can be particularly annoying in Scala.js, because it makes it impossible to declare a type alias whose companion is a JavaScript type (since JavaScript types cannot extend non-JS types such as
Serializable
). See scala-js/scala-js#2244 (comment)The text was updated successfully, but these errors were encountered: