Skip to content

Commit 3c448af

Browse files
committed
Use IFT for Annotation.Child creation (reverted from commit e577f8d)
1 parent 4b580e0 commit 3c448af

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
966966
val sym = tree.symbol
967967
if (sym.is(Method)) {
968968
val setter = sym.setter.orElse {
969-
assert(sym.name.isSetterName && sym.info.firstParamTypes.nonEmpty, sym)
969+
assert(sym.name.isSetterName && sym.info.firstParamTypes.nonEmpty)
970970
sym
971971
}
972972
val qual = tree match {

compiler/src/dotty/tools/dotc/core/Annotations.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ object Annotations {
7575
}
7676

7777
case class LazyBodyAnnotation(private var bodyExpr: Context => Tree) extends BodyAnnotation {
78-
// TODO: Make `bodyExpr` an IFT once #6865 os in bootstrap
7978
private[this] var evaluated = false
8079
private[this] var myBody: Tree = _
8180
def tree(implicit ctx: Context): Tree = {
@@ -151,17 +150,17 @@ object Annotations {
151150
object Child {
152151

153152
/** A deferred annotation to the result of a given child computation */
154-
def later(delayedSym: given Context => Symbol, span: Span)(implicit ctx: Context): Annotation = {
153+
def apply(delayedSym: Context => Symbol, span: Span)(implicit ctx: Context): Annotation = {
155154
def makeChildLater(implicit ctx: Context) = {
156-
val sym = delayedSym
155+
val sym = delayedSym(ctx)
157156
New(defn.ChildAnnotType.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil)
158157
.withSpan(span)
159158
}
160159
deferred(defn.ChildAnnot)(makeChildLater(ctx))
161160
}
162161

163162
/** A regular, non-deferred Child annotation */
164-
def apply(sym: Symbol, span: Span)(implicit ctx: Context): Annotation = later(given _ => sym, span)
163+
def apply(sym: Symbol, span: Span)(implicit ctx: Context): Annotation = apply(_ => sym, span)
165164

166165
def unapply(ann: Annotation)(implicit ctx: Context): Option[Symbol] =
167166
if (ann.symbol == defn.ChildAnnot) {

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,8 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
849849
val start = readIndex
850850
readNat() // skip reference for now
851851
target.addAnnotation(
852-
Annotation.Child.later(atReadPos(start, () => readSymbolRef()), NoSpan))
852+
Annotation.Child(implicit ctx =>
853+
atReadPos(start, () => readSymbolRef()), NoSpan))
853854
}
854855
}
855856

0 commit comments

Comments
 (0)