Skip to content

Commit a21404a

Browse files
committed
Remove unused error messages.
1 parent 40ab53a commit a21404a

File tree

3 files changed

+3
-91
lines changed

3 files changed

+3
-91
lines changed

compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,6 @@ public enum ErrorMessageID {
5757
CyclicReferenceInvolvingImplicitID,
5858
SuperQualMustBeParentID,
5959
AmbiguousImportID,
60-
ErasedPhantomsSignatureCollisionID,
61-
PhantomInheritanceID,
62-
PhantomMixedBoundsID,
63-
PhantomCrossedMixedBoundsID,
64-
MatchPhantomID,
65-
MatchOnPhantomID,
66-
IfElsePhantomID,
67-
PhantomIsInObjectID,
68-
PhantomObjectIsInPackageOrObjectID,
6960
;
7061

7162
public int errorNumber() {

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

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ object messages {
135135
}
136136

137137
case class EmptyCatchBlock(tryBody: untpd.Tree)(implicit ctx: Context)
138-
extends EmptyCatchOrFinallyBlock(tryBody, EmptyCatchBlockID) {
138+
extends EmptyCatchOrFinallyBlock(tryBody, EmptyCatchBlockID) {
139139
val kind = "Syntax"
140140
val msg =
141141
hl"""|The ${"catch"} block does not contain a valid expression, try
@@ -1252,85 +1252,5 @@ object messages {
12521252
| ${"import"} scala.{ $name => ${name.show + "Tick"} }
12531253
|"""
12541254
}
1255-
1256-
case class ErasedPhantomsSignatureCollision(decls: Iterable[Symbol], erased: (Name, Type))(implicit ctx: Context)
1257-
extends Message(ErasedPhantomsSignatureCollisionID) {
1258-
val kind = "Phantom restriction"
1259-
val msg = em"After phantom erasure methods $methodsString will have the same signature: ${erased._1}${erased._2}"
12601255

1261-
private def methodsString = decls.map(decl => em"${decl.name}${decl.info}").mkString(", ")
1262-
1263-
val explanation =
1264-
hl"""|Phantom erasure removes all phantom parameters/arguments from methods and functions.
1265-
|""".stripMargin
1266-
}
1267-
1268-
case class PhantomInheritance(cdef: tpd.TypeDef)(implicit ctx: Context)
1269-
extends Message(PhantomInheritanceID) {
1270-
val kind = "Phantom restriction"
1271-
val msg = perfix + " cannot extend both Any and PhantomAny."
1272-
1273-
def perfix =
1274-
if (cdef.symbol.flags.is(Flags.Trait)) "A trait"
1275-
else if (cdef.symbol.flags.is(Flags.Abstract)) "An abstract class"
1276-
else "A class"
1277-
1278-
val explanation =
1279-
hl"""|""".stripMargin
1280-
}
1281-
1282-
case class PhantomMixedBounds(op: untpd.Ident)(implicit ctx: Context)
1283-
extends Message(PhantomMixedBoundsID) {
1284-
val kind = "Phantom restriction"
1285-
val msg = hl"Can not mix types of ${"Any"} and ${"Phantom.Any"} with ${op.show}."
1286-
1287-
val explanation =
1288-
hl"""|""".stripMargin
1289-
}
1290-
1291-
case class PhantomCrossedMixedBounds(lo: untpd.Tree, hi: untpd.Tree)(implicit ctx: Context)
1292-
extends Message(PhantomCrossedMixedBoundsID) {
1293-
val kind = "Phantom restriction"
1294-
val msg = hl"Type can not be bounded at the same time by types in the ${"Any"} and ${"Phantom.Any"} latices."
1295-
1296-
val explanation =
1297-
hl"""|""".stripMargin
1298-
}
1299-
1300-
case class MatchPhantom(tpdCase: tpd.CaseDef, expected: Type)(implicit ctx: Context) extends Message(MatchPhantomID) {
1301-
val kind = "Phantom restriction"
1302-
val msg = s"Pattern expected case to return a ${expected.show} but was ${tpdCase.tpe.show}"
1303-
1304-
val explanation =
1305-
hl"""|""".stripMargin
1306-
}
1307-
1308-
1309-
case class MatchOnPhantom()(implicit ctx: Context) extends Message(MatchOnPhantomID) {
1310-
val kind = "Phantom restriction"
1311-
val msg = "Cannot pattern match on phantoms"
1312-
1313-
val explanation =
1314-
hl"""|""".stripMargin
1315-
}
1316-
1317-
case class IfElsePhantom(thenp: tpd.Tree, elsep: tpd.Tree)(implicit ctx: Context) extends Message(IfElsePhantomID) {
1318-
val kind = "Phantom restriction"
1319-
val msg =
1320-
s"""if/else cannot have branches with types in different lattices:
1321-
| ${thenp.tpe.show} of lattice ${thenp.tpe.topType.show}
1322-
| ${elsep.tpe.show} of lattice ${elsep.tpe.topType.show}
1323-
""".stripMargin
1324-
1325-
val explanation =
1326-
hl"""|""".stripMargin
1327-
}
1328-
1329-
case class PhantomIsInObject()(implicit ctx: Context) extends Message(PhantomIsInObjectID) {
1330-
val kind = "Phantom restriction"
1331-
val msg = s"Only ${"object"} can extend ${"scala.Phantom"}"
1332-
1333-
val explanation =
1334-
hl"""|""".stripMargin
1335-
}
13361256
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ import core.Decorators._
2323
import dotty.tools.dotc.ast.{Trees, tpd, untpd}
2424
import ast.Trees._
2525
import scala.collection.mutable.ListBuffer
26-
import core.{Constants, Flags, Mode, PhantomErasure}
26+
import dotty.tools.dotc.core.{Constants, Flags}
2727
import ValueClasses._
2828
import TypeUtils._
2929
import ExplicitOuter._
3030
import core.Mode
31+
import core.PhantomErasure
3132

3233
class Erasure extends Phase with DenotTransformer { thisTransformer =>
3334

0 commit comments

Comments
 (0)