diff options
author | Paul Phillips <paulp@improving.org> | 2013-04-04 13:31:45 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-04-05 10:35:00 -0700 |
commit | 6bde11e531b32cc12b1185c5fe6a9135ab2a9b6b (patch) | |
tree | 7246a078b8f72dfd25d04066cc186cc362cd823b /src | |
parent | ca2a09d2934672b16ca9a729ec57bf9211a0a01a (diff) | |
download | scala-6bde11e531b32cc12b1185c5fe6a9135ab2a9b6b.tar.gz scala-6bde11e531b32cc12b1185c5fe6a9135ab2a9b6b.tar.bz2 scala-6bde11e531b32cc12b1185c5fe6a9135ab2a9b6b.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/internal/Types.scala | 9 |
1 files changed, 7 insertions, 2 deletions
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: |