Skip to content

type aliases for opaque types break #6003

Closed
@drdozer

Description

@drdozer

SO ...

opaque type T = String
object T {
  def unwrap(t: T): String = t
}

opaque type U = String
type W = U
object U {
  def unwrap(w: W): String = w
}

The unwrap in T works fine, as advertised. However, unwrap for U fails because it's defined in terms of the type alias W for U.

error]      |  def unwrap(w: W): String = w
[error]     |                             ^
[error]     |                             Found:    W(w)
[error]     |                             Required: String

I would expect W to de-alias to V, and then work.

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