Skip to content

convertToCaseConstructor and typedNew should honor prefix of type params #11103

@adriaanm

Description

@adriaanm

test/files/pos/pattern_relative_types.scala:

trait Outer[O] {
  case class C[T <: O](x: T, y: Outer.this.type)
}

object Foo extends Outer[String]

class Tst {
  val c = new Foo.C("a", Foo)
  c match {
    case Foo.C(a, o) => a
  }
}
$ scalac test/files/pos/pattern_relative_types.scala

test/files/pos/pattern_relative_types.scala:8: error: inferred type arguments [String] do not conform to class C's type parameter bounds [T <: O]
  val c = new Foo.C("a", Foo)
          ^
test/files/pos/pattern_relative_types.scala:8: error: type mismatch;
 found   : String("a")
 required: T
  val c = new Foo.C("a", Foo)
                    ^
two errors found

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions