Skip to content

Commit 44c9328

Browse files
committed
Fix #7472: Pass correct context in Child.later
There was an ovsersight when converting to IFTs.
1 parent 22e64e2 commit 44c9328

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ object Annotations {
154154

155155
/** A deferred annotation to the result of a given child computation */
156156
def later(delayedSym: (given Context) => Symbol, span: Span)(implicit ctx: Context): Annotation = {
157-
def makeChildLater(implicit ctx: Context) = {
157+
def makeChildLater(given ctx: Context) = {
158158
val sym = delayedSym
159159
New(defn.ChildAnnot.typeRef.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil)
160160
.withSpan(span)
161161
}
162-
deferred(defn.ChildAnnot)(makeChildLater(ctx))
162+
deferred(defn.ChildAnnot)(makeChildLater)
163163
}
164164

165165
/** A regular, non-deferred Child annotation */

compiler/test-resources/repl/7472

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
scala> val list = List(1, 2, 3)
2+
val list: List[Int] = List(1, 2, 3)
3+
scala> list.foldLeft(List.empty[Int]){ case (acc, n) => n :: acc }
4+
val res0: List[Int] = List(3, 2, 1)

0 commit comments

Comments
 (0)