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
Compiler crash inferring higher-kinded type from expected type with refinement #9361
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9361?orig=1 |
@retronym said: I actually spotted one "non refactoring" amongst that patch when I originally reviewed it. The discussion seems to be lost in the ashes of paulp/scala, but I found this in my email:
I reverted that change and it doesn't fix the crash. So there must be another needle hidden in that haystack. |
@retronym said (edited on Jun 26, 2015 4:48:46 AM UTC): This seemingly was "refactored" out of use in: scala/scala@c800d1f#diff-05c273d837c49f8b6278b19592a541beR147 Although the end result was still the same, thanks to the way the code was just mutating the access modifiers of members in the anonymous class. |
@retronym said: |
@propensive said: Here's a different, more complex (but still not easy to reduce much further) test case: object Test {
trait Foo {
type Inner
type Result = Ordering[Inner] // any invariant type constructor
def get: Result
}
trait Super
trait Bar[T] extends Super { type Result = T }
def wrap[V <: Super](v: V): Foo { type Inner = this.type with v.type } = ???
val baz: Bar[_] = ???
wrap(baz).get: Ordering[Foo { type Result = this.type }]
} This version does appear to crash every version of the compiler between 2.10.3 and 2.12.0-M1. |
@milessabin said: |
@milessabin said: |
The following will evince the compiler crash:
It appears that in the absence of a type parameter to the
new Foo
instantiation, the type inferencer looks to the expected type offoo
to try to infer it. In the presence of the type refinement in the expected type, this crashes the compiler.This doesn't crash in Scala 2.10.6 (although it doesn't compile), but does with every version from a random sample of 2.11.x releases.
Could be related to #2712.
The text was updated successfully, but these errors were encountered: