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
{{ message }}
Repository navigation
parameter type inference with type paramers broken #1803
the type infered for parameters of an overriding method do not refer to the right type parameter symbol (skolemized / deSkolemized).
lamppc26:~ luc$$ workspace/scala/build/quick/bin/scala -Xexperimental-uniqid
Welcome to Scala version (unknown) (JavaHotSpot(TM) ClientVM, Java1.5.0_16).
Type in expressions to have them evaluated.
Type:help for more information.
scala>classA { deffoo[A](a: A) = a }
defined classA
scala>classBextendsA { overridedeffoo[A](b) = b }
<console>:5:error: typemismatch;
found : ASI-10818required: ASI-10819classBextendsA { overridedeffoo[A](b) = b }
^
$ scala -Yinfer-argument-types -uniqid
Welcome to Scala version 2.11.5 (JavaHotSpot(TM) 64-BitServerVM, Java1.7.0_72).
Type in expressions to have them evaluated.
Type:help for more information.
scala>classA { deffoo[A](a: A) = a }
defined classA
scala>classBextendsA { overridedeffoo[A](b) = b }
defined classB
That one is indeed fixed but another one is broken.
When generic parameters are assigned in deriving class. Methods using those generic parameters used to support type inference when overridden (Scala 2.11), but now no longer do (Scala 2.12).
Scala 2.11
C:\Windows\System32>scala -Yinfer-argument-types
Welcome to Scala version 2.11.7 (JavaHotSpot(TM) 64-BitServerVM, Java1.8.0_112).
Type in expressions to have them evaluated.
Type:help for more information.
scala>traitX[T] { defdoit(t: T):T}
defined traitX
scala>classYextendsX[String] { overridedefdoit(s) = s}
defined classY
Scala 2.12
D:\data\downloads\java\scala\scala-2.12.5\scala-2.12.5\bin>scala -Yinfer-argument-types
Welcome to Scala2.12.5 (JavaHotSpot(TM) 64-BitServerVM, Java1.8.0_112).
Type in expressions for evaluation. Ortry:help.
scala>traitX[T] { defdoit(t: T):T}
defined traitX
scala>classYextendsX[String] { overridedefdoit(s) = s}
<console>:12:error: typemismatch;
found : Trequired: StringclassYextendsX[String] { overridedefdoit(s) = s}
^
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 ;).
Activity
scabug commentedon Mar 18, 2009
Imported From: https://issues.scala-lang.org/browse/SI-1803?orig=1
Reporter: @lrytz
scabug commentedon Feb 6, 2015
kenji yoshida said:
resolved?
spangaer commentedon Apr 5, 2018
That one is indeed fixed but another one is broken.
When generic parameters are assigned in deriving class. Methods using those generic parameters used to support type inference when overridden (Scala 2.11), but now no longer do (Scala 2.12).
Scala 2.11
Scala 2.12
hrhino commentedon Apr 5, 2018
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.
adriaanm commentedon Apr 5, 2018
Yes, this will go away, sorry.
spangaer commentedon Apr 5, 2018
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 ;).