Extension function wins against function with no receiver

This commit is contained in:
Stanislav Erokhin
2015-12-14 13:58:53 +03:00
parent a7503303d5
commit cd80d9408d
4 changed files with 6 additions and 7 deletions
@@ -90,18 +90,17 @@ class TowerResolver {
return null
}
// possible there is explicit member
collectCandidates(TowerData.Empty)?.let { return it }
for (implicitReceiver in context.scopeTower.implicitReceivers) {
collectCandidates(TowerData.OnlyImplicitReceiver(implicitReceiver))?.let { return it }
}
// possible there is explicit member
collectCandidates(TowerData.Empty)?.let { return it }
for (level in context.scopeTower.levels) {
collectCandidates(TowerData.TowerLevel(level))?.let { return it }
for (implicitReceiver in context.scopeTower.implicitReceivers) {
collectCandidates(TowerData.BothTowerLevelAndImplicitReceiver(level, implicitReceiver))?.let { return it }
}
collectCandidates(TowerData.TowerLevel(level))?.let { return it }
}
return resultCollector.getFinalCandidates()
@@ -3,5 +3,5 @@ class B {
~foo~fun foo() = 1
~A.foo~fun A.foo() = 2
fun A.bar() = `foo`foo()
fun A.bar() = `A.foo`foo()
}
@@ -2,5 +2,5 @@
~foo~fun foo() = 2
class A {
fun test() = `foo`foo()
fun test() = `A.foo`foo()
}
@@ -5,7 +5,7 @@ class A {
fun test(a: A) {
with (a) {
`simple`foo()
`extension`foo()
}
}