From 6bde11e531b32cc12b1185c5fe6a9135ab2a9b6b Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 4 Apr 2013 13:31:45 -0700 Subject: Centrally unify module class representations. There are these two representations of a type we wish to treat as the same: TypeRef(pre, sym1, Nil) // sym1.isModuleClass, sym1.sourceModule == sym2 SingleType(pre, sym2) // sym2.isModule, sym2.moduleClass == sym1 I rolled the recognition of this into normalizePlus where it won't bother anyone. normalizePlus is the last effort undertaken by isSameType before it gives up. This allowed significant simplification of logic elsewhere, since there is a great deal of logic working around the fact that a TypeRef might be equivalent to a SingleType even after dealiasing. --- src/reflect/scala/reflect/internal/Types.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index 4b15d6ed78..25b05ae6b3 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -3884,9 +3884,14 @@ trait Types } } - def normalizePlus(tp: Type) = + def normalizePlus(tp: Type) = ( if (isRawType(tp)) rawToExistential(tp) - else tp.normalize + else tp.normalize match { + // Unify the two representations of module classes + case st @ SingleType(_, sym) if sym.isModule => st.underlying.normalize + case _ => tp.normalize + } + ) /* todo: change to: -- cgit v1.2.3