diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-05 12:01:42 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-05 12:01:42 +0100 |
commit | 8bb6ccae5c4f3ec91877fcfe032902f92aa5d2b4 (patch) | |
tree | e2c38a7a7f54d1e5b5a8ea3834823a9bd52453f3 /src/dotty/tools/dotc/typer/Applications.scala | |
parent | 63fa05cf443f9a39b2b2ace1a8b68fc6fe3add70 (diff) | |
download | dotty-8bb6ccae5c4f3ec91877fcfe032902f92aa5d2b4.tar.gz dotty-8bb6ccae5c4f3ec91877fcfe032902f92aa5d2b4.tar.bz2 dotty-8bb6ccae5c4f3ec91877fcfe032902f92aa5d2b4.zip |
Overloading resolution change
NarrowMostSpecific does no longer disable implicits. With implicits disabled, the system is unable
to prefer
def + (x: Int): Int
over
def + (x: Float): Float
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 2519b9a72..ed3759b20 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -673,7 +673,9 @@ trait Applications extends Compatibility { self: Typer => assert(alt1 ne alt2) - /** Is class or module class `sym1` derived from class or module class `sym2`? */ + /** Is class or module class `sym1` derived from class or module class `sym2`? + * Module classes also inherit the relationship from their companions. + */ def isDerived(sym1: Symbol, sym2: Symbol): Boolean = if (sym1 isSubClass sym2) true else if (sym2 is Module) isDerived(sym1, sym2.companionClass) @@ -751,7 +753,9 @@ trait Applications extends Compatibility { self: Typer => private lazy val dummyTree = untpd.Literal(Constant(null)) def dummyTreeOfType(tp: Type): Tree = dummyTree withTypeUnchecked tp - /** Resolve overloaded alternative `alts`, given expected type `pt`. */ + /** Resolve overloaded alternative `alts`, given expected type `pt`. + * todo: use techniques like for implicits to pick candidates quickly? + */ def resolveOverloaded(alts: List[TermRef], pt: Type)(implicit ctx: Context): List[TermRef] = track("resolveOverloaded") { def isDetermined(alts: List[TermRef]) = alts.isEmpty || alts.tail.isEmpty @@ -833,7 +837,7 @@ trait Applications extends Compatibility { self: Typer => } if (isDetermined(candidates)) candidates - else narrowMostSpecific(candidates)(ctx.retractMode(ImplicitsEnabled)) + else narrowMostSpecific(candidates) } } |