aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala')
-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)
+ }
+
}