Skip to content

Commit a7273b5

Browse files
committed
Remove unnecessary untpd.TypSplice
1 parent 9ea5107 commit a7273b5

File tree

4 files changed

+0
-26
lines changed

4 files changed

+0
-26
lines changed

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
110110
case class Splice(expr: Tree)(implicit @constructorOnly src: SourceFile) extends TermTree {
111111
def isInBraces: Boolean = span.end != expr.span.end
112112
}
113-
case class TypSplice(expr: Tree)(implicit @constructorOnly src: SourceFile) extends TypTree
114113
case class ForYield(enums: List[Tree], expr: Tree)(implicit @constructorOnly src: SourceFile) extends TermTree
115114
case class ForDo(enums: List[Tree], body: Tree)(implicit @constructorOnly src: SourceFile) extends TermTree
116115
case class GenFrom(pat: Tree, expr: Tree, checkMode: GenCheckMode)(implicit @constructorOnly src: SourceFile) extends Tree
@@ -612,10 +611,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
612611
case tree: Splice if expr eq tree.expr => tree
613612
case _ => finalize(tree, untpd.Splice(expr)(tree.source))
614613
}
615-
def TypSplice(tree: Tree)(expr: Tree)(using Context): Tree = tree match {
616-
case tree: TypSplice if expr eq tree.expr => tree
617-
case _ => finalize(tree, untpd.TypSplice(expr)(tree.source))
618-
}
619614
def ForYield(tree: Tree)(enums: List[Tree], expr: Tree)(using Context): TermTree = tree match {
620615
case tree: ForYield if (enums eq tree.enums) && (expr eq tree.expr) => tree
621616
case _ => finalize(tree, untpd.ForYield(enums, expr)(tree.source))
@@ -694,8 +689,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
694689
cpy.Quote(tree)(transform(t))
695690
case Splice(expr) =>
696691
cpy.Splice(tree)(transform(expr))
697-
case TypSplice(expr) =>
698-
cpy.TypSplice(tree)(transform(expr))
699692
case ForYield(enums, expr) =>
700693
cpy.ForYield(tree)(transform(enums), transform(expr))
701694
case ForDo(enums, body) =>
@@ -753,8 +746,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
753746
this(x, t)
754747
case Splice(expr) =>
755748
this(x, expr)
756-
case TypSplice(expr) =>
757-
this(x, expr)
758749
case ForYield(enums, expr) =>
759750
this(this(x, enums), expr)
760751
case ForDo(enums, body) =>

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,6 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
691691
keywordStr("'{") ~ toTextGlobal(dropBlock(tree)) ~ keywordStr("}")
692692
case Splice(tree) =>
693693
keywordStr("${") ~ toTextGlobal(dropBlock(tree)) ~ keywordStr("}")
694-
case TypSplice(tree) =>
695-
keywordStr("${") ~ toTextGlobal(dropBlock(tree)) ~ keywordStr("}")
696694
case Thicket(trees) =>
697695
"Thicket {" ~~ toTextGlobal(trees, "\n") ~~ "}"
698696
case MacroTree(call) =>

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ trait QuotesAndSplices {
3838
tree.quoted match {
3939
case untpd.Splice(innerExpr) if tree.isTerm && !ctx.mode.is(Mode.Pattern) =>
4040
report.warning("Canceled splice directly inside a quote. '{ ${ XYZ } } is equivalent to XYZ.", tree.srcPos)
41-
case untpd.TypSplice(innerType) if tree.isType =>
42-
report.warning("Canceled splice directly inside a quote. '[ ${ XYZ } ] is equivalent to XYZ.", tree.srcPos)
4341
case _ =>
4442
}
4543
val qctx = inferImplicitArg(defn.QuotesClass.typeRef, tree.span)
@@ -146,18 +144,6 @@ trait QuotesAndSplices {
146144
ref(defn.QuotedRuntimePatterns_patternHigherOrderHole).appliedToType(pt).appliedTo(typedPat, SeqLiteral(typedArgs, TypeTree(defn.AnyType)))
147145
}
148146

149-
/** Emit error with migration hint */
150-
def typedTypSplice(tree: untpd.TypSplice, pt: Type)(using Context): Tree = {
151-
val msg = "Type splicing with `$` in quotes not supported anymore"
152-
val hint =
153-
if ctx.mode.is(Mode.QuotedPattern) && level == 1 then
154-
"Use lower cased variable name without the `$` instead"
155-
else
156-
"Use a given Type[T] in a quote just write T directly"
157-
report.error(s"$msg\n\nHint: $hint", tree.srcPos)
158-
ref(defn.NothingType)
159-
}
160-
161147
/** Type a pattern variable name `t` in quote pattern as `${given t$giveni: Type[t @ _]}`.
162148
* The resulting pattern is the split in `splitQuotePattern`.
163149
*/

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2906,7 +2906,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
29062906
case untpd.EmptyTree => tpd.EmptyTree
29072907
case tree: untpd.Quote => typedQuote(tree, pt)
29082908
case tree: untpd.Splice => typedSplice(tree, pt)
2909-
case tree: untpd.TypSplice => typedTypSplice(tree, pt)
29102909
case tree: untpd.MacroTree => report.error("Unexpected macro", tree.srcPos); tpd.nullLiteral // ill-formed code may reach here
29112910
case tree: untpd.Hole => typedHole(tree, pt)
29122911
case _ => typedUnadapted(desugar(tree), pt, locked)

0 commit comments

Comments
 (0)