diff options
author | odersky <odersky@gmail.com> | 2017-03-09 14:08:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-09 14:08:23 +0100 |
commit | e28d8ee6819f39eb8e0479a53c63c241affe864c (patch) | |
tree | 7bf21cae3c776f6ab6d37f9306c91cb54f805858 /compiler/src | |
parent | 7f6e01d0019dd9bea5535ca17c6283e64e84fecb (diff) | |
parent | e0b6f397e5476a6a0ca95e81dd3a7a6711f8119e (diff) | |
download | dotty-e28d8ee6819f39eb8e0479a53c63c241affe864c.tar.gz dotty-e28d8ee6819f39eb8e0479a53c63c241affe864c.tar.bz2 dotty-e28d8ee6819f39eb8e0479a53c63c241affe864c.zip |
Merge pull request #2070 from dotty-staging/fix/erasedLub
Fix bug in erasedLub leading to incorrect signatures
Diffstat (limited to 'compiler/src')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/TypeErasure.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala index ff99008bb..2140405b1 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala @@ -246,10 +246,14 @@ object TypeErasure { val cls2 = tp2.classSymbol def loop(bcs: List[ClassSymbol], bestSoFar: ClassSymbol): ClassSymbol = bcs match { case bc :: bcs1 => - if (cls2.derivesFrom(bc)) - if (!bc.is(Trait) && bc != defn.AnyClass) bc - else loop(bcs1, if (bestSoFar.derivesFrom(bc)) bestSoFar else bc) - else + if (cls2.derivesFrom(bc)) { + val newBest = if (bestSoFar.derivesFrom(bc)) bestSoFar else bc + + if (!bc.is(Trait) && bc != defn.AnyClass) + newBest + else + loop(bcs1, newBest) + } else loop(bcs1, bestSoFar) case nil => bestSoFar |