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
scala> f.foo("f", "oo")
java.lang.IllegalArgumentException: wrong number of arguments
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at scala.reflect.Selectable.applyDynamic(Selectable.scala:40)
at scala.reflect.Selectable.applyDynamic$(Selectable.scala:11)
at scala.reflect.Selectable$DefaultSelectable.applyDynamic(Selectable.scala:51)
... 34 elided
Expectation
No exception should be thrown and the result of the two invocations should be the empty string or the string "foo", i.e. the behaviour should be similar as if explicit types were used:
It looks like the problem is because varargs are erased to Seq so there's a mismatch between what the implementation of applyDynamic in reflect.Selectable gets from reflection and what the compiler would expect to be there. Seems related to #16995
Compiler version
3.2.0
Minimized code
Output
Expectation
No exception should be thrown and the result of the two invocations should be the empty string or the string "foo", i.e. the behaviour should be similar as if explicit types were used:
The text was updated successfully, but these errors were encountered: