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

T =:= RefinedType(List(T, AnyRef), Nil) is false #12968

Open
lrytz opened this issue Mar 12, 2024 · 0 comments
Open

T =:= RefinedType(List(T, AnyRef), Nil) is false #12968

lrytz opened this issue Mar 12, 2024 · 0 comments
Labels
Milestone

Comments

@lrytz
Copy link
Member

lrytz commented Mar 12, 2024

In 2.13.13:

scala> :power
scala> trait T

scala> val t = typeOf[T]
scala> val tr = RefinedType(List(t, typeOf[AnyRef]), EmptyScope)

scala> t =:= tr
val res0: Boolean = false

scala> t <:< tr
val res1: Boolean = true

scala> tr <:< t
val res2: Boolean = true

This leads to

scala> trait X { def f: Int }; trait T { def f: X }; class C extends T { def f = new X { def f = 1 } }
                                                                             ^
       error: under -Xsource:3-cross, the inferred type changes to X [quickfixable]

The inferred type for f is RefinedType(List(X, AnyRef), Nil).

@lrytz lrytz added this to the Backlog milestone Mar 12, 2024
@lrytz lrytz added the typer label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant