-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type parameter ignored in selectDynamic invocation #6663
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6663?orig=1 |
@paulp said: |
Jan Niehusmann (jannic) said: |
Jan Niehusmann (jannic) said: scala> new C(42).foo[String].get
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
scala> new C(42).foo[String].get : Int
res2: Int = 42 Here, the [String] parameter is ignored, again. This time because the cxTree starts with the type annotation: (new C.(42).foo[String].get: Int) Is there an easy way to find everything which can possibly get attached to cxTree? |
Jan Niehusmann (jannic) said: |
Jan Niehusmann (jannic) said: |
Jan Niehusmann (jannic) said: |
@paulp said: |
@paulp said: |
As noticed by Dinko Srkoc in http://thread.gmane.org/gmane.comp.lang.scala.user/58246 sometimes the type parameter on a selectDynamic call gets lost.
With this definition:
one gets this behaviour:
This happens because in Typers.scala, mkInvoke is called with the following cxTree:
new C.(42).foo[Int].get
Note that the outer element of that tree is a Select(..., "get"), and that's not handled by mkInvoke:
That can be fixed by adding another case:
With that change, the examples work as expected:
The text was updated successfully, but these errors were encountered: