Skip to content

Commit 161ef49

Browse files
committed
Rename SplicedExpr.{spliced=>expr}
1 parent fe64a3e commit 161ef49

File tree

9 files changed

+29
-29
lines changed

9 files changed

+29
-29
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ object Trees {
682682
type ThisTree[+T <: Untyped] = QuotedExpr[T]
683683
}
684684

685-
case class SplicedExpr[+T <: Untyped] private[ast] (spliced: Tree[T], tpt: Tree[T])(implicit @constructorOnly src: SourceFile)
685+
case class SplicedExpr[+T <: Untyped] private[ast] (expr: Tree[T], tpt: Tree[T])(implicit @constructorOnly src: SourceFile)
686686
extends TermTree[T] {
687687
type ThisTree[+T <: Untyped] = SplicedExpr[T]
688688
}
@@ -1273,9 +1273,9 @@ object Trees {
12731273
case tree: QuotedExpr if (expr eq tree.expr) && (tpt eq tree.tpt) => tree
12741274
case _ => finalize(tree, untpd.QuotedExpr(expr, tpt)(sourceFile(tree)))
12751275
}
1276-
def SplicedExpr(tree: Tree)(spliced: Tree, tpt: Tree)(using Context): SplicedExpr = tree match {
1277-
case tree: SplicedExpr if (spliced eq tree.spliced) && (tpt eq tree.tpt) => tree
1278-
case _ => finalize(tree, untpd.SplicedExpr(spliced, tpt)(sourceFile(tree)))
1276+
def SplicedExpr(tree: Tree)(expr: Tree, tpt: Tree)(using Context): SplicedExpr = tree match {
1277+
case tree: SplicedExpr if (expr eq tree.expr) && (tpt eq tree.tpt) => tree
1278+
case _ => finalize(tree, untpd.SplicedExpr(expr, tpt)(sourceFile(tree)))
12791279
}
12801280
def SingletonTypeTree(tree: Tree)(ref: Tree)(using Context): SingletonTypeTree = tree match {
12811281
case tree: SingletonTypeTree if (ref eq tree.ref) => tree
@@ -1382,8 +1382,8 @@ object Trees {
13821382
TypeDef(tree: Tree)(name, rhs)
13831383
def Template(tree: Template)(using Context)(constr: DefDef = tree.constr, parents: List[Tree] = tree.parents, derived: List[untpd.Tree] = tree.derived, self: ValDef = tree.self, body: LazyTreeList = tree.unforcedBody): Template =
13841384
Template(tree: Tree)(constr, parents, derived, self, body)
1385-
def SplicedExpr(tree: SplicedExpr)(spliced: Tree = tree.spliced, tpt: Tree = tree.tpt)(using Context): SplicedExpr =
1386-
SplicedExpr(tree: Tree)(spliced, tpt)
1385+
def SplicedExpr(tree: SplicedExpr)(expr: Tree = tree.expr, tpt: Tree = tree.tpt)(using Context): SplicedExpr =
1386+
SplicedExpr(tree: Tree)(expr, tpt)
13871387
def Hole(tree: Hole)(isTerm: Boolean = tree.isTerm, idx: Int = tree.idx, args: List[Tree] = tree.args, content: Tree = tree.content, tpt: Tree = tree.tpt)(using Context): Hole =
13881388
Hole(tree: Tree)(isTerm, idx, args, content, tpt)
13891389

@@ -1518,8 +1518,8 @@ object Trees {
15181518
if (trees1 eq trees) tree else Thicket(trees1)
15191519
case tree @ QuotedExpr(expr, tpt) =>
15201520
cpy.QuotedExpr(tree)(transform(expr), transform(tpt))
1521-
case tree @ SplicedExpr(spliced, tpt) =>
1522-
cpy.SplicedExpr(tree)(transform(spliced), transform(tpt))
1521+
case tree @ SplicedExpr(expr, tpt) =>
1522+
cpy.SplicedExpr(tree)(transform(expr), transform(tpt))
15231523
case tree @ Hole(_, _, args, content, tpt) =>
15241524
cpy.Hole(tree)(args = transform(args), content = transform(content), tpt = transform(tpt))
15251525
case _ =>
@@ -1663,8 +1663,8 @@ object Trees {
16631663
this(x, ts)
16641664
case QuotedExpr(expr, tpt) =>
16651665
this(this(x, expr), tpt)
1666-
case SplicedExpr(spliced, tpt) =>
1667-
this(this(x, spliced), tpt)
1666+
case SplicedExpr(expr, tpt) =>
1667+
this(this(x, expr), tpt)
16681668
case Hole(_, _, args, content, tpt) =>
16691669
this(this(this(x, args), content), tpt)
16701670
case _ =>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
173173
def QuotedExpr(expr: Tree, tpt: Tree)(using Context): QuotedExpr =
174174
ta.assignType(untpd.QuotedExpr(expr, tpt), tpt)
175175

176-
def SplicedExpr(spliced: Tree, tpt: Tree)(using Context): SplicedExpr =
177-
ta.assignType(untpd.SplicedExpr(spliced, tpt), tpt)
176+
def SplicedExpr(expr: Tree, tpt: Tree)(using Context): SplicedExpr =
177+
ta.assignType(untpd.SplicedExpr(expr, tpt), tpt)
178178

179179
def TypeTree(tp: Type, inferred: Boolean = false)(using Context): TypeTree =
180180
(if inferred then untpd.InferredTypeTree() else untpd.TypeTree()).withType(tp)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
402402
def JavaSeqLiteral(elems: List[Tree], elemtpt: Tree)(implicit src: SourceFile): JavaSeqLiteral = new JavaSeqLiteral(elems, elemtpt)
403403
def Inlined(call: tpd.Tree, bindings: List[MemberDef], expansion: Tree)(implicit src: SourceFile): Inlined = new Inlined(call, bindings, expansion)
404404
def QuotedExpr(expr: Tree, tpt: Tree)(implicit src: SourceFile): QuotedExpr = new QuotedExpr(expr, tpt)
405-
def SplicedExpr(spliced: Tree, tpt: Tree)(implicit src: SourceFile): SplicedExpr = new SplicedExpr(spliced, tpt)
405+
def SplicedExpr(expr: Tree, tpt: Tree)(implicit src: SourceFile): SplicedExpr = new SplicedExpr(expr, tpt)
406406
def TypeTree()(implicit src: SourceFile): TypeTree = new TypeTree()
407407
def InferredTypeTree()(implicit src: SourceFile): TypeTree = new InferredTypeTree()
408408
def SingletonTypeTree(ref: Tree)(implicit src: SourceFile): SingletonTypeTree = new SingletonTypeTree(ref)

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,12 +673,12 @@ class TreePickler(pickler: TastyPickler) {
673673
.appliedTo(expr)
674674
.withSpan(tree.span)
675675
)
676-
case SplicedExpr(spliced, tpt) =>
676+
case SplicedExpr(expr, tpt) =>
677677
pickleTree(
678678
// scala.quoted.runtime.Expr.splice[<tpt>](<spliced>)
679679
ref(defn.QuotedRuntime_exprSplice)
680680
.appliedToTypeTree(tpt)
681-
.appliedTo(spliced)
681+
.appliedTo(expr)
682682
.withSpan(tree.span)
683683
)
684684
case Hole(_, idx, args, _, tpt) =>

compiler/src/dotty/tools/dotc/inlines/Inliner.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,10 @@ class Inliner(val call: tpd.Tree)(using Context):
834834

835835
override def typedSplicedExpr(tree: untpd.SplicedExpr, pt: Type)(using Context): Tree =
836836
super.typedSplicedExpr(tree, pt) match
837-
case tree1 @ SplicedExpr(spliced, tpt)
837+
case tree1 @ SplicedExpr(expr, tpt)
838838
if StagingLevel.level == 0
839839
&& !hasInliningErrors =>
840-
val expanded = expandMacro(spliced, tree1.srcPos)
840+
val expanded = expandMacro(expr, tree1.srcPos)
841841
transform.TreeChecker.checkMacroGeneratedTree(tree1, expanded)
842842
typedExpr(expanded) // Inline calls and constant fold code generated by the macro
843843
case tree1 => tree1

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
723723
case QuotedExpr(expr, tpt) =>
724724
val tptText = (keywordStr("[") ~ toTextGlobal(tpt) ~ keywordStr("]")).provided(printDebug)
725725
keywordStr("'") ~ tptText ~ keywordStr("{") ~ toTextGlobal(expr) ~ keywordStr("}")
726-
case SplicedExpr(spliced, tpt) =>
726+
case SplicedExpr(expr, tpt) =>
727727
val tptText = (keywordStr("[") ~ toTextGlobal(tpt) ~ keywordStr("]")).provided(printDebug)
728-
keywordStr("$") ~ tptText ~ keywordStr("{") ~ toTextGlobal(spliced) ~ keywordStr("}")
728+
keywordStr("$") ~ tptText ~ keywordStr("{") ~ toTextGlobal(expr) ~ keywordStr("}")
729729
case Hole(isTermHole, idx, args, content, tpt) =>
730730
val (prefix, postfix) = if isTermHole then ("{{{", "}}}") else ("[[[", "]]]")
731731
val argsText = toTextGlobal(args, ", ")

compiler/src/dotty/tools/dotc/transform/FirstTransform.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ class FirstTransform extends MiniPhase with InfoTransformer { thisPhase =>
153153
override def transformOther(tree: Tree)(using Context): Tree = tree match {
154154
case tree: Export => EmptyTree
155155
case tree: NamedArg => transformAllDeep(tree.arg)
156-
case tree @ SplicedExpr(spliced, tpt) =>
156+
case tree @ SplicedExpr(expr, tpt) =>
157157
assert(dotty.tools.dotc.inlines.Inlines.inInlineMethod)
158-
cpy.SplicedExpr(tree)(transformAllDeep(spliced), transformAllDeep(tpt))
158+
cpy.SplicedExpr(tree)(transformAllDeep(expr), transformAllDeep(tpt))
159159
case tree => if (tree.isType) toTypeTree(tree) else tree
160160
}
161161

compiler/src/dotty/tools/dotc/transform/Splicing.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ class Splicing extends MacroTransform:
113113
tree match
114114
case tree: SplicedExpr =>
115115
if level > 1 then
116-
val spliced1 = super.transform(tree.spliced)(using spliceContext)
117-
cpy.SplicedExpr(tree)(spliced1, tree.tpt)
116+
val expr1 = super.transform(tree.expr)(using spliceContext)
117+
cpy.SplicedExpr(tree)(expr1, tree.tpt)
118118
else
119119
val holeIdx = numHoles
120120
numHoles += 1
121121
val splicer = SpliceTransformer(ctx.owner, quotedDefs.contains)
122-
val newSplicedCode1 = splicer.transformSplice(tree.spliced, tree.tpe, holeIdx)(using spliceContext)
122+
val newSplicedCode1 = splicer.transformSplice(tree.expr, tree.tpe, holeIdx)(using spliceContext)
123123
val newSplicedCode2 = Level0QuoteTransformer.transform(newSplicedCode1)(using spliceContext)
124124
newSplicedCode2
125125
case tree: TypeDef if tree.symbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot) =>
@@ -234,9 +234,9 @@ class Splicing extends MacroTransform:
234234
case tree @ Assign(lhs: RefTree, rhs) =>
235235
if isCaptured(lhs.symbol) then transformSplicedAssign(tree)
236236
else super.transform(tree)
237-
case SplicedExpr(spliced, tpt) =>
238-
val spliced1 = transform(spliced)(using spliceContext)
239-
cpy.SplicedExpr(tree)(spliced1, tpt)
237+
case SplicedExpr(expr, tpt) =>
238+
val expr1 = transform(expr)(using spliceContext)
239+
cpy.SplicedExpr(tree)(expr1, tpt)
240240
case Apply(sel @ Select(app @ QuotedExpr(expr, tpt), nme.apply), quotesArgs) =>
241241
expr match
242242
case expr: RefTree if isCaptured(expr.symbol) =>

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,8 +2055,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
20552055
val splicedType = // Quotes ?=> Expr[T]
20562056
defn.FunctionType(1, isContextual = true)
20572057
.appliedTo(defn.QuotesClass.typeRef, defn.QuotedExprClass.typeRef.appliedTo(tpt1.tpe.widenSkolem))
2058-
val spliced1 = typed(tree.spliced, splicedType)(using StagingLevel.spliceContext)
2059-
assignType(cpy.SplicedExpr(tree)(spliced1, tpt1), tpt1)
2058+
val expr1 = typed(tree.expr, splicedType)(using StagingLevel.spliceContext)
2059+
assignType(cpy.SplicedExpr(tree)(expr1, tpt1), tpt1)
20602060

20612061
def completeTypeTree(tree: untpd.TypeTree, pt: Type, original: untpd.Tree)(using Context): TypeTree =
20622062
tree.withSpan(original.span).withAttachmentsFrom(original)

0 commit comments

Comments
 (0)