From 6f8c05722ba4452279e353df2d81b58f260277d2 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 26 Nov 2015 14:26:33 +1000 Subject: SI-9542 Unify different reprs. of module type refs The new unit test shows failures in transitivity of subtyping and type equivalence, which boil down the the inconsistent handling of the semantically equivalent: ThisType(pre, ModuleClass) ModuleTypeRef(pre, ModuleClass) SingleType(pre, Module) This commit: - adds a case to `normalizePlus` to unwrap a `ThisType` to a `ModuleTypeRef` - Use `normalizePlus` more widely during subtype comparison - refactor `fourthTry` (part of `isSubType`) to remove code that becomes obviated by the use of `normalizePlus`. This fixes the regression in the extension methods phase which was triggered by https://github.com/scala/scala/pull/4749. We can also fix that regression by tweaking the extension methods phase itself to emit the `ThisType` representation of the owner of the value class, as before. I plan to demonstrate the two approaches to fixing the regression on separate branches, and the propose that the merged result of these two is useds. --- test/files/pos/t9542.scala | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 test/files/pos/t9542.scala (limited to 'test/files') diff --git a/test/files/pos/t9542.scala b/test/files/pos/t9542.scala new file mode 100644 index 0000000000..d65f7ac4c6 --- /dev/null +++ b/test/files/pos/t9542.scala @@ -0,0 +1,8 @@ +object O { + trait T + + class VC(val self: Any) extends AnyVal { + def extMethod(f: F1[T, Any]) = () + } +} +trait F1[A, B] -- cgit v1.2.3