summaryrefslogtreecommitdiff
path: root/test/files/neg/t7967.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-11-13 10:24:15 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-11-22 12:24:43 +0100
commita5e24768f26bb2d28c7610ff5a184b0c65f56c55 (patch)
treee6689b942a0f5860d64e7d2e7d1d2f7b37f95e0c /test/files/neg/t7967.scala
parent7bdb3f1b2518db9510d709da1d6ae6542d235b65 (diff)
downloadscala-a5e24768f26bb2d28c7610ff5a184b0c65f56c55.tar.gz
scala-a5e24768f26bb2d28c7610ff5a184b0c65f56c55.tar.bz2
scala-a5e24768f26bb2d28c7610ff5a184b0c65f56c55.zip
SI-7967 Account for type aliases in self-type checks
These eluded the check for "illegal inheritance; self-type does not conform" as AliasTypeRef doesn't forward `typeOfThis`. This commit dealiases before calling `typeOfThis`. That seems to be the most localised change. Without the dealias, we had: parent.tpe = TypeRef(pre, sym = AliasTypeSymbol("CC"), Nil) parent.tpe.typeOfThis = parent.tpe.transform(sym.typeOfThis) = CC After: parent.tpe.dealias = TypeRef(pre, sym = ClassSymbol("C"), Nil) parent.tpe.dealias.typeOfThis = C with B
Diffstat (limited to 'test/files/neg/t7967.scala')
-rw-r--r--test/files/neg/t7967.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/files/neg/t7967.scala b/test/files/neg/t7967.scala
new file mode 100644
index 0000000000..4f13347948
--- /dev/null
+++ b/test/files/neg/t7967.scala
@@ -0,0 +1,9 @@
+
+trait B
+trait C {self: B =>}
+
+object Test {
+ new C {} // fails
+ type CC = C
+ new CC {} // should fail, doesn't
+}