Skip to content

Commit

Permalink
Merge pull request #8718 from diesalbla/symbols_update_attachment_lambda
Browse files Browse the repository at this point in the history
Symbols: share the set of Attachments
  • Loading branch information
retronym committed Feb 17, 2020
2 parents fcfbf58 + 7ca7131 commit 516472d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ val mimaFilterSettings = Seq {
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.reflect.api.TypeTags.TypeTagImpl"),
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.reflect.api.Universe.TypeTagImpl"),
ProblemFilters.exclude[MissingClassProblem]("scala.reflect.macros.Attachments$"),
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.reflect.macros.Attachments.cloneAttachments"),
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.reflect.macros.NonemptyAttachments.cloneAttachments"),
ProblemFilters.exclude[DirectAbstractMethodProblem]("scala.collection.immutable.ArraySeq.stepper"),
ProblemFilters.exclude[ReversedAbstractMethodProblem]("scala.collection.immutable.ArraySeq.stepper"),
ProblemFilters.exclude[DirectAbstractMethodProblem]("scala.collection.mutable.ArraySeq.stepper"),
Expand Down
3 changes: 2 additions & 1 deletion src/reflect/scala/reflect/internal/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,8 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
setInfo (this.info cloneInfo clone)
setAnnotations this.annotations
)
this.attachments.all.foreach(clone.updateAttachment)
assert(clone.attachments.isEmpty)
clone.setAttachments(this.attachments.cloneAttachments)
if (clone.thisSym != clone)
clone.typeOfThis = (clone.typeOfThis cloneInfo clone)

Expand Down
2 changes: 2 additions & 0 deletions src/reflect/scala/reflect/macros/Attachments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ abstract class Attachments { self =>
}

def isEmpty: Boolean = true
def cloneAttachments: Attachments { type Pos = self.Pos } = this
}

private object Attachments {
Expand All @@ -97,4 +98,5 @@ private final class NonemptyAttachments[P >: Null](override val pos: P, override
type Pos = P
def withPos(newPos: Pos) = new NonemptyAttachments(newPos, all)
override def isEmpty: Boolean = false
override def cloneAttachments: Attachments { type Pos = P } = new NonemptyAttachments[P](pos, all)
}

0 comments on commit 516472d

Please sign in to comment.