Skip to content

constructors & getters-setters #187

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

Closed
wants to merge 58 commits into from
Closed

Conversation

DarkDimius
Copy link
Contributor

This branch has the same code as in #186 but has a lot cleaner history.
Difference is several additional tests that were somehow lost in #186 and ElimLocals and Flatten being in transform package

odersky and others added 30 commits October 11, 2014 08:24
The idea to traverse with currently enclosing methid is also used in
LambdaLift and could be used elsewhere.
…lled.

Instead of requiring to be called a given phase, change the context if
that is not the case.
Lifting an application  `f(arg1).f(args)` requires lifting of the whole prefix
`f(arg1)`, because `f` might have a side effect.
Advantage: Can rename typed as well as untyped trees.
Previously, we determined the default getters solely from the method TermRef type.
This is wrong if the method is prefix is not a path -- the prefix of the term ref will be a
TypeRef and the getter selection will be a SelectFromType tree, which makes no sense.
It changes meaning drastically so should always be visible.
Some transformations encounter applications where new arguments ahve to be
supplied. The method type already accounts for these argument but the
Application node passed into TreeTransform#transformApply is constructed
with a cpy.Apply operation which does a type assignment. That type assignment
fails with a parameter mismatch unless relaxedTyping is on.
Environment parameters do not count in th eresult type.
The current formulation of lambda lift is easier to do if that's the case.
Need to drop all non-class type declarations.
Params are already added by Desugar. No special treatment needed here.
Besides primaryConstructor.typeParams is always empty, because term symbols
do not have type parameters.

The fix turns t2660.scala into an error. I believe the error is correct, hence
the test was moved with a comment to neg.
Primary constructor was picking last constructor instead of first one.
This is now fixed. Also, added paramAccessors utility method.
Needed to fix a problem in CapturedVars to make this work.
Like the corresponding parameters, these also need to be rewritten to function types.
1) Type parameters are now copied to accessors
2) Constructors also work for traits

2) makes it possible do to mixin after constructors.
TypeVars can appear as keys in baseType caches. The problem is that
their base types depend on their instantiation, which is not always
know yet when the test is performed. So results of baseType on
type variables should never be cached.

Todo: check whether there are any other caching problems involving typevars.
Typevars can be parts of larger types or underlying types of
other types, which renders these other types uncacheable. The new
logic takes account of that.
Private fields that are accessed only from the constructor,
and are accessed only after they are properly initialized are now
moved into the constructor. This avoids creating a redundant objetc field.
Good example: gcd in Rationals (see constrs.scala).
…ories.

We better make this configurable. Because sometimes we want to compile only the files
in the immediate directory.
odersky and others added 18 commits October 12, 2014 10:50
1) Avoids unneccessary second adapt.
2) Avoids error when used in TreeChecking when we try to compare
   types in previous tree and new tree - if we used `typed`, the
   previous tree would not have a type!
Similar to Erasure, we do not check conformance wrt <:< to a FunProto.
Nothing is lost, because we typecheck the arguments and result anyway.
And this led to failing tests after GettersSetters was added.
Was lost in merge chaos between pattern macther and rest
And bring back two tests for typing of patterns
1) strip TypeVars where necessary before widening
2) allow the combination of widening and dealiasing, in any order.
... because Any is not an erasedType (this is now checked)
Avoids a stale symbol error when compiling all files in tools together.
Previously caused an illegal backwards timetravel in bringForward when compiling
all files in tools together twice.
Tests now always include erasure (before quite a few tests failed when erasure
was enableed). By contrast lazy vals creates problems with erasure, disabled
for now.

Some other small polishings on integration of pattern matcher with rest of dotc.

Deep recompilation of tools still fails, currently disabled.
@DarkDimius
Copy link
Contributor Author

This branch also includes clean history of #176.

@odersky
Copy link
Contributor

odersky commented Oct 12, 2014

OK if you want to try to rebase using this branch as a basis, go ahead! It
would surely be better to have a good history. But you need to make sure
you get the "fix" commits towards the end of #187 in there as well, because
these address problems discovered when merging with the pattern matcher.

The ElimLocals and Flatten transforms had been added in the last commit of
#187. I'll soon integrate LambdaLift and start working on Mixin. So it
would be good to have a stable basis for that. If you can get your changes
in today, that's good. Otherwise I prefer to work on what we have.

Thanks!

On Sun, Oct 12, 2014 at 11:17 AM, Dmitry Petrashko <notifications@github.com

wrote:

This branch also includes clean history of #176
#176.


Reply to this email directly or view it on GitHub
#187 (comment).

Martin Odersky
EPFL

@DarkDimius
Copy link
Contributor Author

But you need to make sure you get the "fix" commits towards the end of #187 in there as well, because these address problems discovered when merging with the pattern matcher.

@odersky I guess you mean fixes from #186 They are all in this branch. It's not the branch to rebase on, this is the branch that already includes everything in our pull requests.

The ElimLocals and Flatten transforms had been added in the last commit of #187.

They were introduced several times in different packages. The last but one commit that was indicating that it's cleaning up patmat acutally removed them once again. I've modified the commit to not remove them and didn't include the last commit that introduced them back in different package.

If you can get your changes in today, that's good.
They are already here. I've diffed the status of this branch with #186 and the diff is additional tests included in this one but omitted in #186.

So it's better to base on this branch. I've already had a look on commits multiple times during rebasings, they look good. I would propose to merge this branch into master(which means constructors&getters and setters will be in).

I would like to also propose to alter a bit the way how we made bugfixes: have the branch upstream where the fixes are included independently of the phase being developped I believe it's better to work on the same codebase as we are all discovering bugs and merging 2 implementations that both rewrite same existing functionality to fix either the same or even different bugs is tricky.

@odersky
Copy link
Contributor

odersky commented Oct 12, 2014

Sent from my phone

On 12.10.2014, at 12:28, Dmitry Petrashko notifications@github.com wrote:

But you need to make sure you get the "fix" commits towards the end of #187 in there as well, because these address problems discovered when merging with the pattern matcher.

@odersky I guess you mean fixes from #186 They are all in this branch. It's not the branch to rebase on, this is the branch that already includes everything in our pull requests.

The ElimLocals and Flatten transforms had been added in the last commit of #187.

They were introduced several times in different packages. The last but one commit that was indicating that it's cleaning up patmat acutally removed them once again. I've modified the commit to not remove them and didn't include the last commit that introduced them back in different package.

Ah ok. I could only read the mails at the airport, did not realize everything was merged already. That's great! Is #187 good to go in from your side? In that case I would review and merge unless I find problems.
If you can get your changes in today, that's good.
They are already here. I've diffed the status of this branch with #186 and the diff is additional tests included in this one but omitted in #186.

So it's better to base on this branch. I've already had a look on commits multiple times during rebasings, they look good. I would propose to merge this branch into master(which means constructors&getters and setters will be in).

I would like to also propose to alter a bit the way how we made bugfixes: have the branch upstream where the fixes are included independently of the phase being developped I believe it's better to work on the same codebase as we are all discovering bugs and merging 2 implementations that both rewrite same existing functionality to fix either the same or even different bugs is tricky.


Reply to this email directly or view it on GitHub.

@odersky
Copy link
Contributor

odersky commented Oct 13, 2014

Can you put the PR on staging please?

@DarkDimius DarkDimius closed this Oct 13, 2014
@odersky odersky mentioned this pull request Oct 26, 2014
tgodzik added a commit that referenced this pull request Mar 26, 2025
bugfix: Fix issues with releasing
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.

2 participants