From a5e24768f26bb2d28c7610ff5a184b0c65f56c55 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 13 Nov 2013 10:24:15 +0100 Subject: 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 --- test/files/neg/t7967.scala | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/files/neg/t7967.scala (limited to 'test/files/neg/t7967.scala') 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 +} -- cgit v1.2.3