Skip to content

Commit e577f8d

Browse files
committed
Use IFT for Annotation.Child creation
1 parent 6f078df commit e577f8d

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)
969+
assert(sym.name.isSetterName && sym.info.firstParamTypes.nonEmpty, sym)
970970
sym
971971
}
972972
val qual = tree match {

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ 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
7879
private[this] var evaluated = false
7980
private[this] var myBody: Tree = _
8081
def tree(implicit ctx: Context): Tree = {
@@ -159,17 +160,17 @@ object Annotations {
159160
object Child {
160161

161162
/** A deferred annotation to the result of a given child computation */
162-
def apply(delayedSym: Context => Symbol, span: Span)(implicit ctx: Context): Annotation = {
163+
def later(delayedSym: given Context => Symbol, span: Span)(implicit ctx: Context): Annotation = {
163164
def makeChildLater(implicit ctx: Context) = {
164-
val sym = delayedSym(ctx)
165+
val sym = delayedSym
165166
New(defn.ChildAnnotType.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil)
166167
.withSpan(span)
167168
}
168169
deferred(defn.ChildAnnot)(makeChildLater(ctx))
169170
}
170171

171172
/** A regular, non-deferred Child annotation */
172-
def apply(sym: Symbol, span: Span)(implicit ctx: Context): Annotation = apply(_ => sym, span)
173+
def apply(sym: Symbol, span: Span)(implicit ctx: Context): Annotation = later(given _ => sym, span)
173174

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

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

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

0 commit comments

Comments
 (0)