-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix missing changesParents in PostTyper #20062
Conversation
I cannot assign reviewers. Could you have a look at this PR @nicolasstucki ? /cc: @olhotak |
I will have a look. @hamzaremmal could you add @liufengyun to the new Scala 3 contributors group? |
Done. @liufengyun you should be able to ask for reviewers and merge PRs now. |
@liufengyun could you push this PR again to trigger the tests on [test_scala2_library_tasty]. Rebase and push usually works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks functionally good to me. I am not sure if we have a better way to fix this. I will reasing to @odersky to make sure we do not break or degrade preforence for the compiler when not compiling the Scala 2 library.
@@ -36,12 +36,16 @@ class Checker extends Phase: | |||
traverser.traverse(unit.tpdTree) | |||
|
|||
override def runOn(units: List[CompilationUnit])(using Context): List[CompilationUnit] = | |||
val checkCtx = ctx.fresh.setPhase(this.start) | |||
val checkCtx = ctx.fresh.setPhase(this) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this could have unintended consecuences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously we did something wrong --- otherwise, the tree and symbol info will not be in sync.
2e5db2c
to
07f6949
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
/** | ||
* Serializable and AbstractFunction are added for scala2-library companion object of case class | ||
* | ||
* Ideally `compilingScala2StdLib` should be used, but it is initialized too late to be effective. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could try to move these three statements in Run.compileUnits earlier in front of ctx.base.usePhases(phases)
:
val runCtx = ctx.fresh
runCtx.setProfiler(Profiler())
unfusedPhases.foreach(_.initContext(runCtx))
That should allow us to use compilingScala2StdLib
.
val pluginPlan = ctx.base.addPluginPhases(ctx.base.phasePlan) | ||
val phases = ctx.base.fusePhases(pluginPlan, | ||
ctx.settings.Yskip.value, ctx.settings.YstopBefore.value, stopAfter, ctx.settings.Ycheck.value) | ||
ctx.base.usePhases(phases) | ||
ctx.base.usePhases(phases, runCtx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this change? @odersky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that looks good to me.
val pluginPlan = ctx.base.addPluginPhases(ctx.base.phasePlan) | ||
val phases = ctx.base.fusePhases(pluginPlan, | ||
ctx.settings.Yskip.value, ctx.settings.YstopBefore.value, stopAfter, ctx.settings.Ycheck.value) | ||
ctx.base.usePhases(phases) | ||
ctx.base.usePhases(phases, runCtx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that looks good to me.
Without the setting, the outdated baseData cache will be used which produces incorrect baseClasses
Discussed with @nicolasstucki offline
c91a748
to
a3d0098
Compare
The following two problems lead to crash of -Ysafe-init-global while compiling scala2-library-bootstrapped:
[test_scala2_library_tasty]