diff options
author | Enno Runne <enno@runne.net> | 2017-02-22 20:13:20 +0100 |
---|---|---|
committer | Enno Runne <enno@runne.net> | 2017-02-22 20:13:20 +0100 |
commit | 3c2b09f2a16d04b7f5c10c87faba14c62e5896a4 (patch) | |
tree | 7ee3ee5686121b9b7546e00354e8b3bf9c3ad9af /compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala | |
parent | 40ce201bb8087503b6f55f49c67980318fc1bfdb (diff) | |
download | dotty-3c2b09f2a16d04b7f5c10c87faba14c62e5896a4.tar.gz dotty-3c2b09f2a16d04b7f5c10c87faba14c62e5896a4.tar.bz2 dotty-3c2b09f2a16d04b7f5c10c87faba14c62e5896a4.zip |
Added explanation for CantInstatiateAbstractClassOrTrait
Diffstat (limited to 'compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index 1ad606076..03af81770 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -1132,7 +1132,18 @@ object messages { 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 = "" + val explanation = + hl"""|Abstract classes and traits need to be extended by a concrete class or object + |to make their functionality accessible. + | + |You may want to create an anonymous class extending ${cls.name} with + | ${s"class ${cls.name} { }"} + | + |or add a companion object with + | ${s"object ${cls.name} extends ${cls.name}"} + | + |You need to implement any abstract members in both cases. + |""".stripMargin } } |