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
parameter type inference with type paramers broken #1803
Comments
Imported From: https://issues.scala-lang.org/browse/SI-1803?orig=1 |
kenji yoshida said: $ scala -Yinfer-argument-types -uniqid
Welcome to Scala version 2.11.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_72).
Type in expressions to have them evaluated.
Type :help for more information.
scala> class A { def foo[A](a: A) = a }
defined class A
scala> class B extends A { override def foo[A](b) = b }
defined class B |
That one is indeed fixed but another one is broken. Scala 2.11 C:\Windows\System32>scala -Yinfer-argument-types
Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions to have them evaluated.
Type :help for more information.
scala> trait X[T] { def doit(t: T): T}
defined trait X
scala> class Y extends X[String] { override def doit(s) = s}
defined class Y Scala 2.12 D:\data\downloads\java\scala\scala-2.12.5\scala-2.12.5\bin>scala -Yinfer-argument-types
Welcome to Scala 2.12.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> trait X[T] { def doit(t: T): T}
defined trait X
scala> class Y extends X[String] { override def doit(s) = s}
<console>:12: error: type mismatch;
found : T
required: String
class Y extends X[String] { override def doit(s) = s}
^ |
I think this feature may be on the chopping block (as part of scala/scala-dev#430), so this might become a won't-fix soon. |
Yes, this will go away, sorry. |
Faster response than expected. Well, I got this in via -Xexperimental which I had put in in the process of enabling Java 8 lambda bytecode in 2.11. Wasn't aware of the matter, but built quite a bit of code base that relied on it :( Ok, out it goes. Hope you get a chance to respond to my comment in the referred issue equally fast ;). |
the type infered for parameters of an overriding method do not refer to the right type parameter symbol (skolemized / deSkolemized).
The text was updated successfully, but these errors were encountered: