diff options
author | Adriaan Moors <adriaan@lightbend.com> | 2017-04-13 09:02:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-13 09:02:19 -0700 |
commit | 8a413ba7cc7a32210fc2d734c18032b718035116 (patch) | |
tree | 7d7cec3c558bb89db482863c3573cfe049f0affb /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | 5167b691bbc6eccc671ef3a49c7ecaf3343c0baa (diff) | |
parent | 77917e94c70759602be0dae833e798e894999254 (diff) | |
download | scala-8a413ba7cc7a32210fc2d734c18032b718035116.tar.gz scala-8a413ba7cc7a32210fc2d734c18032b718035116.tar.bz2 scala-8a413ba7cc7a32210fc2d734c18032b718035116.zip |
Merge pull request #5846 from adriaanm/t10261-2.11
Actually retract clashing synthetic apply/unapply
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 00e0517df6..ac0a653626 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3093,6 +3093,8 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper val scope = if (inBlock) context.scope else context.owner.info.decls var newStats = new ListBuffer[Tree] var moreToAdd = true + val retractErroneousSynthetics = settings.isScala212 + while (moreToAdd) { val initElems = scope.elems // SI-5877 The decls of a package include decls of the package object. But we don't want to add @@ -3101,7 +3103,9 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper inBlock || !context.isInPackageObject(sym, context.owner) for (sym <- scope) for (tree <- context.unit.synthetics get sym if shouldAdd(sym)) { // OPT: shouldAdd is usually true. Call it here, rather than in the outer loop - newStats += typedStat(tree) // might add even more synthetics to the scope + // if the completer set the IS_ERROR flag, retract the stat (currently only used by applyUnapplyMethodCompleter) + if (!(retractErroneousSynthetics && sym.initialize.hasFlag(IS_ERROR))) + newStats += typedStat(tree) // might add even more synthetics to the scope context.unit.synthetics -= sym } // the type completer of a synthetic might add more synthetics. example: if the |