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 3.7.1-RC1 (11.0.26, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> trait A { def f(a: Array[AnyRef]): Any }
// defined trait A
scala> def g(a: A) = a.f(Array.empty[AnyRef])
def g(a: A): Any
scala> g((x: Array[? >: AnyRef]) => x.headOption)
java.lang.BootstrapMethodError: bootstrap method initialization exception
at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:194)
at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:258)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:248)
... 66 elided
Caused by: java.lang.invoke.LambdaConversionException: Type mismatch for instantiated parameter 0: class java.lang.Object is not a subtype of class [Ljava.lang.Object;
at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.checkDescriptor(AbstractValidatingLambdaMetafactory.java:308)
at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:294)
at java.base/java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:503)
at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:138)
... 69 more
JDK 8
Welcome to Scala 3.7.1-RC1 (1.8.0_442, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> trait A { def f(a: Array[AnyRef]): Any }
// defined trait A
scala> def g(a: A) = a.f(Array.empty[AnyRef])
def g(a: A): Any
scala> g((x: Array[? >: AnyRef]) => x.headOption)
val res0: Any = None
Expectation
compile error or success. don't throw runtime error
Note
Scala 2.13.16
Welcome to Scala 2.13.16 (OpenJDK 64-Bit Server VM, Java 11.0.26).
Type in expressions for evaluation. Or try :help.
scala> trait A { def f(a: Array[AnyRef]): Any }
trait A
scala> def g(a: A) = a.f(Array.empty[AnyRef])
def g(a: A): Any
scala> g((x: Array[? >: AnyRef]) => x.headOption)
val res0: Any = None
Scala 2.12.20
Welcome to Scala 2.12.20 (OpenJDK 64-Bit Server VM, Java 11.0.26).
Type in expressions for evaluation. Or try :help.
scala> trait A { def f(a: Array[AnyRef]): Any }
defined trait A
scala> def g(a: A) = a.f(Array.empty[AnyRef])
g: (a: A)Any
scala> g((x: Array[? >: AnyRef]) => x.headOption)
res0: Any = None
The text was updated successfully, but these errors were encountered:
Compiler version
Minimized code
JDK 11 or later
JDK 8
Expectation
compile error or success. don't throw runtime error
Note
Scala 2.13.16
Scala 2.12.20
The text was updated successfully, but these errors were encountered: