From 40ce201bb8087503b6f55f49c67980318fc1bfdb Mon Sep 17 00:00:00 2001 From: Enno Runne Date: Mon, 20 Feb 2017 22:12:44 +0100 Subject: Change 'is abstract; cannot be instantiated' to Message --- .../src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java | 4 +++- compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'compiler/src/dotty/tools/dotc/reporting') diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java b/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java index c74130b44..2bf15cb7c 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java @@ -49,7 +49,9 @@ public enum ErrorMessageID { OverridesNothingButNameExistsID, ForwardReferenceExtendsOverDefinitionID, ExpectedTokenButFoundID, - MixedLeftAndRightAssociativeOpsID; + MixedLeftAndRightAssociativeOpsID, + CantInstantiateAbstractClassOrTraitID, + ; public int errorNumber() { return ordinal() - 2; diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index 7fccebef9..1ad606076 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -1127,4 +1127,12 @@ object messages { |""".stripMargin } + case class CantInstantiateAbstractClassOrTrait(cls: Symbol, isTrait: Boolean)(implicit ctx: Context) + extends Message(CantInstantiateAbstractClassOrTraitID) { + val kind = "Usage" + private val traitOrAbstract = if (isTrait) hl"a trait" else hl"abstract" + val msg = hl"""${cls.name} is ${traitOrAbstract}; it cannot be instantiated""" + val explanation = "" + } + } -- cgit v1.2.3