aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty/tools/dotc/reporting
diff options
context:
space:
mode:
authorEnno Runne <enno@runne.net>2017-02-20 22:12:44 +0100
committerEnno Runne <enno@runne.net>2017-02-20 22:12:44 +0100
commit40ce201bb8087503b6f55f49c67980318fc1bfdb (patch)
tree64eac4960e67bc551d70aebe37c7a36e0ff13b92 /compiler/test/dotty/tools/dotc/reporting
parentf467be62da8978e506f58b702b84e74ef7ce09de (diff)
downloaddotty-40ce201bb8087503b6f55f49c67980318fc1bfdb.tar.gz
dotty-40ce201bb8087503b6f55f49c67980318fc1bfdb.tar.bz2
dotty-40ce201bb8087503b6f55f49c67980318fc1bfdb.zip
Change 'is abstract; cannot be instantiated' to Message
Diffstat (limited to 'compiler/test/dotty/tools/dotc/reporting')
-rw-r--r--compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala39
1 files changed, 39 insertions, 0 deletions
diff --git a/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala b/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala
index 37d1404bb..971a40a1b 100644
--- a/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala
+++ b/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala
@@ -159,4 +159,43 @@ class ErrorMessagesTests extends ErrorMessagesTest {
assertEquals("+:", op2.show)
assertFalse(op2LeftAssoc)
}
+
+ @Test def cantInstantiateAbstract =
+ checkMessagesAfter("refchecks") {
+ """
+ |object Scope {
+ | abstract class Concept
+ | new Concept()
+ |}
+ """.stripMargin
+ }
+ .expect { (ictx, messages) =>
+ implicit val ctx: Context = ictx
+ val defn = ictx.definitions
+
+ assertMessageCount(1, messages)
+ val CantInstantiateAbstractClassOrTrait(cls, isTrait) :: Nil = messages
+ assertEquals("Concept", cls.name.show)
+ assertFalse("expected class", isTrait)
+ }
+
+ @Test def cantInstantiateTrait =
+ checkMessagesAfter("refchecks") {
+ """
+ |object Scope {
+ | trait Concept
+ | new Concept()
+ |}
+ """.stripMargin
+ }
+ .expect { (ictx, messages) =>
+ implicit val ctx: Context = ictx
+ val defn = ictx.definitions
+
+ assertMessageCount(1, messages)
+ val CantInstantiateAbstractClassOrTrait(cls, isTrait) :: Nil = messages
+ assertEquals("Concept", cls.name.show)
+ assertTrue("expected trait", isTrait)
+ }
+
}