Skip to content

Commit 435c8ff

Browse files
committed
Remove unnecessary untpd.TypSplice
1 parent f95f0c7 commit 435c8ff

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
@@ -613,10 +612,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
613612
case tree: Splice if expr eq tree.expr => tree
614613
case _ => finalize(tree, untpd.Splice(expr)(tree.source))
615614
}
616-
def TypSplice(tree: Tree)(expr: Tree)(using Context): Tree = tree match {
617-
case tree: TypSplice if expr eq tree.expr => tree
618-
case _ => finalize(tree, untpd.TypSplice(expr)(tree.source))
619-
}
620615
def ForYield(tree: Tree)(enums: List[Tree], expr: Tree)(using Context): TermTree = tree match {
621616
case tree: ForYield if (enums eq tree.enums) && (expr eq tree.expr) => tree
622617
case _ => finalize(tree, untpd.ForYield(enums, expr)(tree.source))
@@ -695,8 +690,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
695690
cpy.Quote(tree)(transform(t))
696691
case Splice(expr) =>
697692
cpy.Splice(tree)(transform(expr))
698-
case TypSplice(expr) =>
699-
cpy.TypSplice(tree)(transform(expr))
700693
case ForYield(enums, expr) =>
701694
cpy.ForYield(tree)(transform(enums), transform(expr))
702695
case ForDo(enums, body) =>
@@ -754,8 +747,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
754747
this(x, t)
755748
case Splice(expr) =>
756749
this(x, expr)
757-
case TypSplice(expr) =>
758-
this(x, expr)
759750
case ForYield(enums, expr) =>
760751
this(this(x, enums), expr)
761752
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
@@ -2898,7 +2898,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
28982898
case untpd.EmptyTree => tpd.EmptyTree
28992899
case tree: untpd.Quote => typedQuote(tree, pt)
29002900
case tree: untpd.Splice => typedSplice(tree, pt)
2901-
case tree: untpd.TypSplice => typedTypSplice(tree, pt)
29022901
case tree: untpd.MacroTree => report.error("Unexpected macro", tree.srcPos); tpd.nullLiteral // ill-formed code may reach here
29032902
case tree: untpd.Hole => typedHole(tree, pt)
29042903
case _ => typedUnadapted(desugar(tree), pt, locked)

0 commit comments

Comments
 (0)