aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/dotc/tests.scala1
-rw-r--r--tests/neg/moduleSubtyping.scala23
2 files changed, 24 insertions, 0 deletions
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala
index 71668823a..89ac2b6c4 100644
--- a/test/dotc/tests.scala
+++ b/test/dotc/tests.scala
@@ -117,6 +117,7 @@ class tests extends CompilerTest {
@Test def neg_i0091_infpaths = compileFile(negDir, "i0091-infpaths", xerrors = 3)
@Test def neg_i0248_inherit_refined = compileFile(negDir, "i0248-inherit-refined", xerrors = 4)
@Test def neg_i0281 = compileFile(negDir, "i0281-null-primitive-conforms", xerrors = 3)
+ @Test def neg_moduleSubtyping = compileFile(negDir, "moduleSubtyping", xerrors = 4)
@Test def dotc = compileDir(dotcDir + "tools/dotc", failedOther)(allowDeepSubtypes)
@Test def dotc_ast = compileDir(dotcDir + "tools/dotc/ast", failedOther) // similar to dotc_config
diff --git a/tests/neg/moduleSubtyping.scala b/tests/neg/moduleSubtyping.scala
new file mode 100644
index 000000000..18e93d5ac
--- /dev/null
+++ b/tests/neg/moduleSubtyping.scala
@@ -0,0 +1,23 @@
+class C {
+
+ object o {
+
+ var a: C.this.o.type = ???
+ var b: this.type = ???
+ a = b // OK
+ b = a // OK
+
+ var c: Test.o.type = ???
+ a = c // error
+ b = c // error
+ c = a // error
+ c = b // error
+ }
+
+}
+
+object Test extends C {
+
+
+
+}