Skip to content

Fix #3058: Use the proper type for the "thisLocalVar" of tailrec. #3059

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 1 commit into from
Jul 17, 2017

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Jul 14, 2017

In Scala 2.12, if a tail-recursive method is in a class or trait with a self-type, the type of the _$this local variable is the self type. We previously assumed it was always the current class type, which produced invalid IR in that case.

@sjrd sjrd requested a review from gzm0 July 14, 2017 14:00
if (tryingToGenMethodAsJSFunction) {
throw new CancelGenMethodAsJSFunction(
"Trying to generate `this` inside the body")
}
js.This()(currentClassType)
} { thisLocalIdent =>
js.VarRef(thisLocalIdent)(currentClassType)
} { thisLocalInfo =>
Copy link
Contributor

Choose a reason for hiding this comment

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

case (thisLocalIdent, thisLocalTpe) =>?

Copy link
Member Author

Choose a reason for hiding this comment

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

I hesitated. Done.

…rec.

In Scala 2.12, if a tail-recursive method is in a class or trait
with a self-type, the type of the `_$this` local variable is the
self type. We previously assumed it was always the current class
type, which produced invalid IR in that case.
@sjrd sjrd force-pushed the fix-invalid-ir-tailrec-trait-2.12 branch from f99b7be to 1518b70 Compare July 14, 2017 15:12
@scala-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):

https://scala-webapps.epfl.ch/jenkins/job/scalajs-pr/4117/
https://scala-webapps.epfl.ch/jenkins/job/scalajs-matrix-build/5478/
Test PASSed.

@scala-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):

https://scala-webapps.epfl.ch/jenkins/job/scalajs-pr/4118/
https://scala-webapps.epfl.ch/jenkins/job/scalajs-matrix-build/5479/
Test PASSed.

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