Skip to content

FullParametrization: allow to have $this of ThisType. #1091

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 4 commits into from
Mar 31, 2016

Conversation

DarkDimius
Copy link
Contributor

TailRec methods remain members of enclosing class,
it means that they can refer to methods that require this.type.
It means that tailrec, unlike value classes is not allowed to widen
type of $this to it's full self type.

Fixes #1089

@DarkDimius
Copy link
Contributor Author

@sjrd please review

* @param abstractOverClass if true, include the type parameters of the class in the method's list of type parameters.
* @param liftThisType if true, require created $this to be $this: (Foo[A] & Foo,this).
Copy link
Member

Choose a reason for hiding this comment

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

Is Foo,this a typo for Foo.this?

Copy link
Member

Choose a reason for hiding this comment

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

Why not have the type of $this simply be Foo.this when liftThisType is true?

@sjrd
Copy link
Member

sjrd commented Feb 15, 2016

As far as I understand, LGTM.
There are couple of neg tests failing. It might just be that they need their checkfile to be updated.

@DarkDimius
Copy link
Contributor Author

@sjrd, neg tests fail as normal. Actual test failure is in ./scala-scala/src/library/scala/collection/immutable/TrieIterator.scala. I'm having a look at it.

TailRec methods remain members of enclosing class,
it means that they can refer to methods that require this.type.
It means that tailrec, unlike value classes is not allowed to widen
type of $this to it's full self type.

Fixes scala#1089
If the method that recurses over a different type arguments,
if this method is specialised, it would lead to method not
being tail-rec anymore.

Eg:

def foo[@specialized A, @specialized B]: Unit = foo[B, A]
This is a simpler fix than the previous one.
Local methods, cannot change `this` and do not need to go through
FullParameterization.
@DarkDimius
Copy link
Contributor Author

rebased over master.

@DarkDimius
Copy link
Contributor Author

@sjrd please have a look.
You could also try rebasing #1061 over this

@sjrd
Copy link
Member

sjrd commented Mar 31, 2016

LGTM. I'll rebase the other one to see if it passes.

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.

4 participants