Skip to content

New asSeenFrom does not skolemize some types that should be skolemized #1009

Closed
@smarter

Description

@smarter

#999 changed the way asSeenFrom works and it introduced a bug:

class Contra[-T]

class Foo {
  val foo: Contra[this.type] = new Contra[this.type]
}
object Test {
  def test: Unit = {
    val e1 = new Foo
    val f1: Contra[Foo] = e1.foo // error, as expected
    var e2 = new Foo
    val f2: Contra[Foo] = e2.foo // should be an error but now succeeds
  }
}

The problem is that we removed this line:

val m = if (isLegalPrefix(pre)) null else new AsSeenFromMap(pre, cls)

but asSeenFrom#toPrefix still assumes that the prefix is always legal when the map is null.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions