diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-07-03 22:39:38 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-07-04 20:47:22 +0400 |
commit | 0529dd502a45e29aa617986ff9ab29e145d62582 (patch) | |
tree | 992e898503ee18b2eff4e59c3a345889bac852bf /src/reflect | |
parent | 1fe5087c8e7713cbb42e1da6c1486de3531dd544 (diff) | |
download | scala-0529dd502a45e29aa617986ff9ab29e145d62582.tar.gz scala-0529dd502a45e29aa617986ff9ab29e145d62582.tar.bz2 scala-0529dd502a45e29aa617986ff9ab29e145d62582.zip |
SI-5959 type equality now accounts for mirrors
TypeRef(ThisType(<package1>), sym, args) should always be equal to
TypeRef(ThisType(<package2>), sym, args) regardless of whether
package1 and package2 actually represent the same symbols of not.
This goes for subtyping (<:<) and type equality (=:=).
However regular equality (==) and hashconsing is unaffected
as per http://groups.google.com/group/scala-internals/browse_thread/thread/4bef4e6987bb68fe
This is done to account for the fact that mirrors share normal symbols,
but never share package symbols. Therefore at times it will occur that
the same types loaded by different mirrors appear different because of
the package symbols. More details: https://issues.scala-lang.org/browse/SI-5959.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/Types.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index 5a382cf518..96a6d4bba0 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -5125,7 +5125,7 @@ trait Types extends api.Types { self: SymbolTable => false private def equalSymsAndPrefixes(sym1: Symbol, pre1: Type, sym2: Symbol, pre2: Type): Boolean = - if (sym1 == sym2) sym1.hasPackageFlag || phase.erasedTypes || pre1 =:= pre2 + if (sym1 == sym2) sym1.hasPackageFlag || sym1.owner.hasPackageFlag || phase.erasedTypes || pre1 =:= pre2 else (sym1.name == sym2.name) && isUnifiable(pre1, pre2) /** Do `tp1` and `tp2` denote equivalent types? */ @@ -5612,7 +5612,7 @@ trait Types extends api.Types { self: SymbolTable => val sym2 = tr2.sym val pre1 = tr1.pre val pre2 = tr2.pre - (((if (sym1 == sym2) phase.erasedTypes || isSubType(pre1, pre2, depth) + (((if (sym1 == sym2) phase.erasedTypes || sym1.owner.hasPackageFlag || isSubType(pre1, pre2, depth) else (sym1.name == sym2.name && !sym1.isModuleClass && !sym2.isModuleClass && (isUnifiable(pre1, pre2) || isSameSpecializedSkolem(sym1, sym2, pre1, pre2) || |