Skip to content

a path dependent type does not conform to its projection type #17064

Closed
@ftucky

Description

@ftucky

Compiler version

3.2.2 , 3.3.0-RC3

Minimized code

class HiddenInner[+O<:Outer](val outer:O){
}

class Outer{
  type Inner = HiddenInner[this.type]
}

val o : Outer       = new Outer 
val a : o.Inner     = new o.Inner(o)
val b : Outer#Inner = a // DOES NOT COMPILE

Output

Found:    (a : o.Inner)
Required: Outer#Inner

Expectation

Code should compile: o.Inner conforms to Outer#Inner.
Note Outer is a class, so Outer#Inner is legal (sound) in scala3.

Compiles in scala 2.13.

Intention

The intention is to make Inner behave almost as inner class of Outer.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions