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

Lubs have lost precision since 2.9 #5302

Closed
scabug opened this issue Dec 13, 2011 · 4 comments
Closed

Lubs have lost precision since 2.9 #5302

scabug opened this issue Dec 13, 2011 · 4 comments
Assignees

Comments

@scabug
Copy link

scabug commented Dec 13, 2011

scala> trait A { val x: A }
defined trait A

scala> trait B { val x: B }
defined trait B

scala> class C extends A with B { lazy val x = new C }
defined class C

scala> class D extends A with B { lazy val x = new D }
defined class D

scala> if (true) new C else new D
res0: ScalaObject with A with B = C@662ad0d

In 2.9 the type of res0 was ScalaObject with A with B { val x: ScalaObject with A with B }.

@scabug
Copy link
Author

scabug commented Dec 13, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5302?orig=1
Reporter: @xeno-by

@scabug
Copy link
Author

scabug commented Dec 13, 2011

@paulp said:
If you run that sequence with "scala -Dscalac.debug.lub" you will see why:

Malformed lub: ScalaObject with A with B{val x: ScalaObject with A with B}
Argument C does not conform.  Falling back to ScalaObject with A with B
lub of List(C, D) is ScalaObject with A with B

So unless I'm further gone than I'm thought, the lub can't be right if one of the contributors to the lub does not conform to it. scalac thinks that !(t <:< lubRefined), in this case that C does not conform. So there is a bug somewhere, but right at this moment it looks to me like a bug in the subtyping logic. I'll open to suggestions.

@scabug
Copy link
Author

scabug commented Dec 13, 2011

@paulp said:
Assigning back to you for either your own suggestion or because you have proximity to martin.

@scabug
Copy link
Author

scabug commented Dec 16, 2011

@paulp said:
Closing as duplicate of #5317 ; see my comment there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants