Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong erasure of path-dependent opaque type alias #403

Closed
adpi2 opened this issue Nov 29, 2023 · 1 comment
Closed

Wrong erasure of path-dependent opaque type alias #403

adpi2 opened this issue Nov 29, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@adpi2
Copy link
Member

adpi2 commented Nov 29, 2023

package example

trait Foo[T]:
  opaque type Type <: T = T

class Bar extends Foo[String]:
  def bar(x: Type): Unit = ???

If I call ErasedTypeRef.erase on the type of arg x in bar it returns Any but it should return String.

@adpi2
Copy link
Member Author

adpi2 commented Nov 29, 2023

A similar bug:

package example

class Value[T](v: T) extends AnyVal

class C[T <: Int]:
  def m(x: Value[T]): Unit = ???

ErasedTypeRef.erase on the type of x returns Object instead of Int

@sjrd sjrd self-assigned this Nov 29, 2023
@sjrd sjrd added the bug Something isn't working label Nov 29, 2023
@sjrd sjrd changed the title Wrong erasure of opaque type Wrong erasure of path-dependent opaque type alias Nov 29, 2023
@sjrd sjrd closed this as completed in 9eb273a Nov 30, 2023
sjrd added a commit that referenced this issue Nov 30, 2023
Fix #403: Take the prefix of opaque type aliases into account in erasure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants