Skip to content

Commit 5f9f364

Browse files
committed
Throw exception for TypeError.getMessage
1 parent 5c70826 commit 5f9f364

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/core/TypeErrors.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import config.Printers.cyclicErrors
1717

1818
class TypeError(msg: String) extends Exception(msg) {
1919
def this() = this("")
20-
def toMessage(implicit ctx: Context): Message = getMessage
20+
def toMessage(implicit ctx: Context): Message = super.getMessage
21+
override def getMessage: String = throw new Exception("Use toMessage instead for TypeError")
2122
}
2223

2324
class MalformedType(pre: Type, denot: Denotation, absMembers: Set[Name]) extends TypeError {

0 commit comments

Comments
 (0)