Skip to content

Commit 0c6727c

Browse files
Merge pull request #12619 from dotty-staging/fix-#12584
Fix type of `let` reference
2 parents d099811 + cf022a0 commit 0c6727c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
295295
def unapply(vdef: ValDef): (String, TypeTree, Option[Term]) =
296296
(vdef.name.toString, vdef.tpt, optional(vdef.rhs))
297297

298-
def let(owner: Symbol, name: String, rhs: Term)(body: Ident => Term): Term =
298+
def let(owner: Symbol, name: String, rhs: Term)(body: Ref => Term): Term =
299299
val vdef = tpd.SyntheticValDef(name.toTermName, rhs)(using ctx.withOwner(owner))
300-
val ref = tpd.ref(vdef.symbol).asInstanceOf[Ident]
300+
val ref = tpd.ref(vdef.symbol).asInstanceOf[Ref]
301301
Block(List(vdef), body(ref))
302302

303-
def let(owner: Symbol, terms: List[Term])(body: List[Ident] => Term): Term =
303+
def let(owner: Symbol, terms: List[Term])(body: List[Ref] => Term): Term =
304304
val ctx1 = ctx.withOwner(owner)
305305
val vdefs = terms.map(term => tpd.SyntheticValDef("x".toTermName, term)(using ctx1))
306-
val refs = vdefs.map(vdef => tpd.ref(vdef.symbol).asInstanceOf[Ident])
306+
val refs = vdefs.map(vdef => tpd.ref(vdef.symbol).asInstanceOf[Ref])
307307
Block(vdefs, body(refs))
308308
end ValDef
309309

library/src/scala/quoted/Quotes.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,14 +590,14 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
590590
def unapply(vdef: ValDef): (String, TypeTree, Option[Term])
591591

592592
/** Creates a block `{ val <name> = <rhs: Term>; <body(x): Term> }` */
593-
def let(owner: Symbol, name: String, rhs: Term)(body: Ident => Term): Term
593+
def let(owner: Symbol, name: String, rhs: Term)(body: Ref => Term): Term
594594

595595
/** Creates a block `{ val x = <rhs: Term>; <body(x): Term> }` */
596-
def let(owner: Symbol, rhs: Term)(body: Ident => Term): Term =
596+
def let(owner: Symbol, rhs: Term)(body: Ref => Term): Term =
597597
let(owner, "x", rhs)(body)
598598

599599
/** Creates a block `{ val x1 = <terms(0): Term>; ...; val xn = <terms(n-1): Term>; <body(List(x1, ..., xn)): Term> }` */
600-
def let(owner: Symbol, terms: List[Term])(body: List[Ident] => Term): Term
600+
def let(owner: Symbol, terms: List[Term])(body: List[Ref] => Term): Term
601601
}
602602

603603
/** Makes extension methods on `ValDef` available without any imports */

0 commit comments

Comments
 (0)