You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 1, 2020. It is now read-only.
A lazy val declared inside an anonymous class inside a specialized
context no longer crashes Duplicators.
Previously, a duplicated lazy val was assigned to the wrong owner
in Duplicators:
def x[B >: A]: Unit = new Bounds[B] {
lazy val it = ??? // def or val okay
}
Above, the `it` in `$anon` in `x$mcZ$sp` had its owner set to `x$mcZ$sp`
instead of `$anon`. This crashed the typer when it had to retype its
lazy accessor, because there was no `lazy var it` in `$anon$`.
Furthermore, the duplicated symbol wasn't being added to the list of
declarations of `$anon`.
Changes:
1) `invalidate` in Duplicators takes an additional parameter which is
the new owner of the new symbol that has to be duplicated. If this parameter
is set to `NoSymbol`, then the new owner is `context.owner`, as before.
2) the newly created lazy val symbol is being added to the list of
declarations of its new owner.
Removes debugging output from the previous commit.
Review by dragos.
@mention dragos
@@ -257,7 +259,6 @@ abstract class Duplicators extends Analyzer {
257
259
super.typed(ddef, mode, pt)
258
260
259
261
case vdef @ValDef(mods, name, tpt, rhs) =>
260
-
log("vdef: "+ vdef)
261
262
// log("vdef fixing tpe: " + tree.tpe + " with sym: " + tree.tpe.typeSymbol + " and " + invalidSyms)
262
263
//if (mods.hasFlag(Flags.LAZY)) vdef.symbol.resetFlag(Flags.MUTABLE) // Martin to Iulian: lazy vars can now appear because they are no longer boxed; Please check that deleting this statement is OK.
263
264
vdef.tpt.tpe = fixType(vdef.tpt.tpe)
@@ -359,15 +360,11 @@ abstract class Duplicators extends Analyzer {
0 commit comments