Skip to content

Commit ccdeb85

Browse files
committed
Remove error that cannot appear anymore
Now that we do not support the old syntax for splicing types it is not possible to get this error. The code is buggy and fails with another error that is not worth testing.
1 parent cb77c5c commit ccdeb85

File tree

5 files changed

+1
-25
lines changed

5 files changed

+1
-25
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,8 +1906,6 @@ object desugar {
19061906
new UntypedTreeTraverser {
19071907
def traverse(tree: untpd.Tree)(using Context): Unit = tree match {
19081908
case Splice(expr) => collect(expr)
1909-
case TypSplice(expr) =>
1910-
report.error(TypeSpliceInValPattern(expr), tree.srcPos)
19111909
case _ => traverseChildren(tree)
19121910
}
19131911
}.traverse(expr)

compiler/src/dotty/tools/dotc/reporting/ErrorMessageID.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ enum ErrorMessageID extends java.lang.Enum[ErrorMessageID]:
163163
ExtensionCanOnlyHaveDefsID,
164164
UnexpectedPatternForSummonFromID,
165165
AnonymousInstanceCannotBeEmptyID,
166-
TypeSpliceInValPatternID,
166+
TypeSpliceInValPatternID, // Error does not exist anymore
167167
ModifierNotAllowedForDefinitionID,
168168
CannotExtendJavaEnumID,
169169
InvalidReferenceInImplicitNotFoundAnnotationID,

compiler/src/dotty/tools/dotc/reporting/messages.scala

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,15 +2478,6 @@ import transform.SymUtils._
24782478
|""".stripMargin
24792479
}
24802480

2481-
class TypeSpliceInValPattern(expr: untpd.Tree)(using Context)
2482-
extends SyntaxMsg(TypeSpliceInValPatternID) {
2483-
def msg = "Type splices cannot be used in val patterns. Consider using `match` instead."
2484-
def explain =
2485-
em"""|Type splice: `$$${expr.show}` cannot be used in a `val` pattern. Consider rewriting the `val` pattern
2486-
|as a `match` with a corresponding `case` to replace the `val`.
2487-
|""".stripMargin
2488-
}
2489-
24902481
class ModifierNotAllowedForDefinition(flag: Flag)(using Context)
24912482
extends SyntaxMsg(ModifierNotAllowedForDefinitionID) {
24922483
def msg = em"Modifier ${hl(flag.flagsString)} is not allowed for this definition"

tests/neg-macros/type-splice-in-val-pattern.check

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/neg-macros/type-splice-in-val-pattern.scala

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)