diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-12 18:06:35 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-12 18:06:35 +0200 |
commit | ab8ee535fc2f16f3ece55326e58dec6171614829 (patch) | |
tree | e06a7cd9ca9fef52fada1c0ec30a3840acfdc15b /src/dotty | |
parent | 472d7114da29c869e3fa2e97b7045b797937737b (diff) | |
download | dotty-ab8ee535fc2f16f3ece55326e58dec6171614829.tar.gz dotty-ab8ee535fc2f16f3ece55326e58dec6171614829.tar.bz2 dotty-ab8ee535fc2f16f3ece55326e58dec6171614829.zip |
mergeDenot should prefer concerete over deferred.
Previously it did this only sometimes. Now it always prefers
concrete over deferred unless the deferred info is a proper subtype
of the concrete info.
Diffstat (limited to 'src/dotty')
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index f4e9746c7..dceec47a2 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -231,13 +231,16 @@ object Denotations { else if (denot1.signature matches denot2.signature) { val info1 = denot1.info val info2 = denot2.info + val sym1 = denot1.symbol val sym2 = denot2.symbol val sym2Accessible = sym2.isAccessibleFrom(pre) - if (sym2Accessible && info2 <:< info1) denot2 + def prefer(info1: Type, sym1: Symbol, info2: Type, sym2: Symbol) = + info1 <:< info2 && + (sym1.isAsConcrete(sym2) || !(info2 <:< info1)) + if (sym2Accessible && prefer(info2, sym2, info1, sym1)) denot2 else { - val sym1 = denot1.symbol val sym1Accessible = sym1.isAccessibleFrom(pre) - if (sym1Accessible && info1 <:< info2) denot1 + if (sym1Accessible && prefer(info1, sym1, info2, sym2)) denot1 else if (sym1Accessible && sym2.exists && !sym2Accessible) denot1 else if (sym2Accessible && sym1.exists && !sym1Accessible) denot2 else { |