diff options
Diffstat (limited to 'src')
3 files changed, 7 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala index ba135d7d25..069d6d5fb2 100644 --- a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala @@ -391,8 +391,10 @@ trait PatternTypers { else freshUnapplyArgType() ) ) + val unapplyArgTree = Ident(unapplyArg) updateAttachment SubpatternsAttachment(args) + // clearing the type is necessary so that ref will be stabilized; see bug 881 - val fun1 = typedPos(fun.pos)(Apply(Select(fun.clearType(), unapplyMethod), Ident(unapplyArg) :: Nil)) + val fun1 = typedPos(fun.pos)(Apply(Select(fun.clearType(), unapplyMethod), unapplyArgTree :: Nil)) def makeTypedUnApply() = { // the union of the expected type and the inferred type of the argument to unapply diff --git a/src/reflect/scala/reflect/internal/StdAttachments.scala b/src/reflect/scala/reflect/internal/StdAttachments.scala index 46f241643b..09fd996f39 100644 --- a/src/reflect/scala/reflect/internal/StdAttachments.scala +++ b/src/reflect/scala/reflect/internal/StdAttachments.scala @@ -35,4 +35,7 @@ trait StdAttachments { /** Identifies trees are either result or intermidiate value of for loop desugaring. */ case object ForAttachment extends PlainAttachment + + /** Untyped list of subpatterns attached to selector dummy. */ + case class SubpatternsAttachment(patterns: List[Tree]) } diff --git a/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala b/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala index 974706aa0b..e296a28779 100644 --- a/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala +++ b/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala @@ -57,6 +57,7 @@ trait JavaUniverseForce { self: runtime.JavaUniverse => this.CompoundTypeTreeOriginalAttachment this.BackquotedIdentifierAttachment this.ForAttachment + this.SubpatternsAttachment this.noPrint this.typeDebug // inaccessible: this.maxFree |