Skip to content

Fix trait constructors #699

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 10 commits into from
Jul 1, 2015
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 26, 2015

Trait constructors added a this to the constructor of a trait, which is useless
because the constructor's type is unit. By contrast, it's good to rename the DefDef
to the new name.

Discovered while trying to isolate #685. This causes a -Ycheck:traitConstructor error for all traits.
Review by @DarkDimius

@smarter
Copy link
Member

smarter commented Jun 26, 2015

This causes a -Ycheck:traitConstructor error for all traits.

Can we add traitConstructors to defaultOptions in tests.scala or would that break something ?

@odersky
Copy link
Contributor Author

odersky commented Jun 26, 2015

Note: The error we are seeing here is the same I have been chasing for a while and one that did not show up in the tests for several releases (including commits to main) before.But they did show up in local runs. It is fixed in #697.

So the right order should be to get #697 in and then try again.

@odersky odersky force-pushed the fix/trait-constructors branch from 6a18eee to 69141c6 Compare June 26, 2015 16:10
odersky added 7 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.
Uncommented parts that were left accidentally commented out when debugging.
Trait constructors added a this to the constructor of a trait, which is useless
because the constructor's type is unit. By contrast, it's good to rename the DefDef
to the new name.
@odersky odersky force-pushed the fix/trait-constructors branch from 69141c6 to 3290164 Compare June 26, 2015 16:16
@odersky
Copy link
Contributor Author

odersky commented Jun 26, 2015

Rebased on top of pending #697

It did not do enough to carry its own weight, in particular because DenotationTransformers do have
a price - every encountered denotation in the whole program is passed through them. The name change
from <init> to $init$ was all it did, that is now rolled into Mixin.

Also renamed IMPLCLASS_CONSTRUCTOR to TRAIT_CONSTRUCTOR.
@odersky
Copy link
Contributor Author

odersky commented Jun 27, 2015

Can we add traitConstructors to defaultOptions in tests.scala or would that break something ?

@smarter Even without traitConstructors, we get "bad owners" in several tests when checking after the last group. Not sure why. Would be good to investigate.

DarkDimius added a commit that referenced this pull request Jul 1, 2015
@DarkDimius DarkDimius merged commit 65b0c37 into scala:master Jul 1, 2015
@allanrenucci allanrenucci deleted the fix/trait-constructors branch December 14, 2017 19:23
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