Skip to content

Commit 64e1866

Browse files
Fix Missing error message on FailureToEliminateExistential
1 parent 953a385 commit 64e1866

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import classfile.ClassfileParser
2828
import scala.collection.{ mutable, immutable }
2929
import scala.collection.mutable.ListBuffer
3030
import scala.annotation.switch
31+
import dotty.tools.dotc.reporting.diagnostic.messages.FailureToEliminateExistential
3132

3233
object Scala2Unpickler {
3334

@@ -676,11 +677,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
676677
val anyTypes = boundSyms map (_ => defn.AnyType)
677678
val boundBounds = boundSyms map (_.info.bounds.hi)
678679
val tp2 = tp1.subst(boundSyms, boundBounds).subst(boundSyms, anyTypes)
679-
ctx.warning(s"""failure to eliminate existential
680-
|original type : $tp forSome {${ctx.dclsText(boundSyms, "; ").show}
681-
|reduces to : $tp1
682-
|type used instead: $tp2
683-
|proceed at own risk.""".stripMargin)
680+
ctx.warning(FailureToEliminateExistential(tp, tp1, tp2, boundSyms))
684681
tp2
685682
} else tp1
686683
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public enum ErrorMessageID {
101101
ReturnOutsideMethodDefinitionID,
102102
UncheckedTypePatternID,
103103
ExtendFinalClassID,
104+
FailureToEliminateExistentialID
104105
;
105106

106107
public int errorNumber() {

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,4 +1778,15 @@ object messages {
17781778
hl"""A class marked with the ${"final"} keyword cannot be extended"""
17791779
}
17801780

1781+
case class FailureToEliminateExistential(tp: Types.Type, tp1: Types.Type, tp2: Types.Type, boundSyms: List[Symbols.Symbol])(implicit ctx: Context)
1782+
extends Message(FailureToEliminateExistentialID) {
1783+
val kind = "Syntax"
1784+
val msg = hl"failure to eliminate existential"
1785+
val explanation =
1786+
hl"""original type : $tp forSome {${ctx.dclsText(boundSyms, "; ").show}
1787+
|reduces to : $tp1
1788+
|type used instead: $tp2
1789+
|proceed at own risk.
1790+
|"""
1791+
}
17811792
}

0 commit comments

Comments
 (0)