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

soundness issue with mutually-recursive type members #9715

Open
scabug opened this issue Mar 23, 2016 · 2 comments
Open

soundness issue with mutually-recursive type members #9715

scabug opened this issue Mar 23, 2016 · 2 comments
Labels
fixed in Scala 3 should not compile
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Mar 23, 2016

trait O { type A >: Any <: B; type B >: A <: Nothing }
val o = new O {}
def id(a: Any): Nothing = (a: o.B)
id("Boom")
@scabug
Copy link
Author

@scabug scabug commented Mar 23, 2016

Imported From: https://issues.scala-lang.org/browse/SI-9715?orig=1
Reporter: @namin
Affected Versions: 2.11.8, 2.12.0-RC1

@scabug scabug added this to the Backlog milestone Apr 7, 2017
@dwijnand dwijnand added the fixed in Scala 3 label May 14, 2021
@dwijnand
Copy link
Member

@dwijnand dwijnand commented May 14, 2021

3.0.0:

scala> trait O { type A >: Any <: B; type B >: A <: Nothing }
     | val o = new O {}
     | def id(a: Any): Nothing = (a: o.B)
     | id("Boom")
1 |trait O { type A >: Any <: B; type B >: A <: Nothing }
  |               ^
  |illegal cyclic type reference: upper bound O.this.B of type A refers back to the type itself
3 |def id(a: Any): Nothing = (a: o.B)
  |                           ^
  |                           Found:    (a : Any)
  |                           Required: o.B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in Scala 3 should not compile
Development

No branches or pull requests

2 participants