-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
The following:
class Foo[A]
class Outer {
class Bar[B] extends Foo[B]
}
object Test {
def test = {
val foo: Foo[Int] = {
val o = new Outer
new o.Bar[Int]
}
}
}Fails with:
error: type mismatch:
found : Foo{A = Outer$Bar$$B; Outer$Bar$$B = Int}
required: Foo[Int]
val foo: Foo[Int] = {
^The issue is that in TypeAssigner#avoid we replace:
o.Bar { Outer$bar$$B = Int }by (this is not the best solution, see #711, but that's a separate issue):
Foo { Foo$$A = Outer$bar$$B } { Outer$Bar$$B = Int }But at this point we cannot infer that Foo$$A = Int because these refinements are not prefixed by RefinedThis so they're independent. It seems that we should either:
- change the encoding of type parameters
- or add a simple and robust method to go from
o.Bar { Outer$Bar$$B = Int }to its "real" parent type which isFoo { Foo$$A = Int }.
@odersky : what do you think?
Metadata
Metadata
Assignees
Labels
No labels