Skip to content

Opaque type with generic forgets its boundaries #8152

Closed
@rcano

Description

@rcano

minimized code

object opaque {
  opaque type Foo[X] <: String = String
}
object test {
  val s: String = ???.asInstanceOf[opaque.Foo[_]]
}

Compilation output

Found:    guarana.swing.opaque.Foo[?]
Required: String(7)

expectation

It should compile. Note that this does compile

object opaque {
  opaque type Foo <: String = String
}
object test {
  val s: String = ???.asInstanceOf[opaque.Foo]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions