Skip to content

Fix erasure of this types and refactor value class erasure #697

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

Merged
merged 6 commits into from
Jun 26, 2015

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 26, 2015

Thistypes erased to the underlying class. This is wrong. When seen as part of some other type,
a ThisType has to erase to the erasure of the underlying type (i.e. the erasure if the selftype
of the class). unittest-collections.scala failed with a MethodNotFound error because the erasure
was computed incorrectly.

On the other hand, a tree with a ThisType type, should keep the type, analogous to a
tree with a TermRef type.

Also, refactored value class erasure to avoid spreading semiEraseVCs.

Fixes #682

Rview by @DarkDimius @smarter

This was referenced Jun 26, 2015
@odersky
Copy link
Contributor Author

odersky commented Jun 26, 2015

rebased to master

odersky added 5 commits June 26, 2015 18:12
Thistypes erased to the underlying class. This is wrong. When seen as part of some other type,
a ThisType has to erase to the erasure of the underlying type (i.e. the erasure if the selftype
of the class). unittest-collections.scala failed with a MethodNotFound error because the erasure
was computed incorrectly.

On the other hand, a tree with a ThisType type, should keep the type, analogous to a
tree with a TermRef type.
The file consisted of just a deprecation warning. Not sure what was deprecated; neither dotty
nor scalac find anything wrong with it.
There's one behavioral change: on typedSelectFromTypeTree, we use erasedType as for a notmal ref.
Before semiEraseVCs was always set to false here. I don't see how the treatment should be different.
E.g. it should not matter if we see a

     x.y
or

     T#y
Checking that constraints are closed caused cyclic reference exceptions in
DottyBackedInterface. What's worrying is that these were seemingly not checked
by the checkin tests. Or maybe there is some dependcy on compilation order that triggers
the erros only in my setup.
Replace by the pair of methods erasure/valueErasure.
The boolean parameter is still kept, but only as a
confuration parameter of the erasure objects.
@odersky odersky force-pushed the fix/erasure-thistypes-vcs branch from 1effc93 to 28751a1 Compare June 26, 2015 16:12
Uncommented parts that were left accidentally commented out when debugging.
@@ -14,7 +14,7 @@ import core._
import Phases.Phase
import Types._, Contexts._, Constants._, Names._, NameOps._, Flags._, DenotTransformers._
import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._, Scopes._, Denotations._
import TypeErasure.{ erasure, ErasedValueType }
import TypeErasure.{ erasure, valueErasure, ErasedValueType }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

erasure does not need to be imported anymore.

@smarter
Copy link
Member

smarter commented Jun 26, 2015

LGTM otherwise, it's nice that this simplified erasure a bit.

odersky added a commit that referenced this pull request Jun 26, 2015
Fix erasure of this types and refactor value class erasure
@odersky odersky merged commit 68b4e6c into scala:master Jun 26, 2015
@odersky
Copy link
Contributor Author

odersky commented Jun 26, 2015

@smarter I dropped the import in #699

@allanrenucci allanrenucci deleted the fix/erasure-thistypes-vcs branch December 14, 2017 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants