aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Denotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-05-01 09:22:17 +0200
committerMartin Odersky <odersky@gmail.com>2016-05-18 19:43:21 +0200
commitf36c21ed9f79a1fc41e36d7c5221a070d83e61a7 (patch)
treec24e42e5f785414bdef3673fd45fc848596283f1 /src/dotty/tools/dotc/core/Denotations.scala
parent134ad7a6a172fec97dc438dd0aff3766a0f0944a (diff)
downloaddotty-f36c21ed9f79a1fc41e36d7c5221a070d83e61a7.tar.gz
dotty-f36c21ed9f79a1fc41e36d7c5221a070d83e61a7.tar.bz2
dotty-f36c21ed9f79a1fc41e36d7c5221a070d83e61a7.zip
Avoid merging denotations of different symbols in same class
#1240 shows that we need to detect ambiguous overloads of methods coming from the same base class (with different signatures there) that have the same signature in some deriving class. This was undetected before because the two methods were simply merged into one overloaded alternative.
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/Denotations.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala
index 946738d73..8003e68ac 100644
--- a/src/dotty/tools/dotc/core/Denotations.scala
+++ b/src/dotty/tools/dotc/core/Denotations.scala
@@ -282,8 +282,15 @@ object Denotations {
val info2 = denot2.info
val sym1 = denot1.symbol
val sym2 = denot2.symbol
- val sym2Accessible = sym2.isAccessibleFrom(pre)
+ if (sym1.exists && sym2.exists &&
+ (sym1 ne sym2) && (sym1.owner eq sym2.owner) &&
+ !sym1.is(Bridge) && !sym2.is(Bridge))
+ // double definition of two methods with same signature in one class;
+ // don't merge them.
+ return NoDenotation
+
+ val sym2Accessible = sym2.isAccessibleFrom(pre)
/** Does `sym1` come before `sym2` in the linearization of `pre`? */
def precedes(sym1: Symbol, sym2: Symbol) = {
def precedesIn(bcs: List[ClassSymbol]): Boolean = bcs match {