Skip to content

Self application of polymorphic type leads to Ycheck errors #13143

Open
@odersky

Description

@odersky

Compiler version

3.0.2

Minimized code

object O{
  val v = [T] => (y:T) => (x:y.type) => 3
  def m = v(v)   // works
}

object O2{
  val v = [T] => (y:T) => (x:y.type) => 3
  def m = v(identity(v))  // error
}

Output

When compiling with -Ycheck:

exception occurred while compiling i6682a.scala
java.lang.AssertionError: assertion failed: Found:    [T] => (y: T) => y.type => Int
Required: [T] => (y: Any) => y².type => Int

where:    y  is a reference to a value parameter
          y² is a reference to a value parameter```

Expectation

No errors

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions