Extension function wins against function with no receiver
This commit is contained in:
@@ -90,18 +90,17 @@ class TowerResolver {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// possible there is explicit member
|
|
||||||
collectCandidates(TowerData.Empty)?.let { return it }
|
|
||||||
for (implicitReceiver in context.scopeTower.implicitReceivers) {
|
for (implicitReceiver in context.scopeTower.implicitReceivers) {
|
||||||
collectCandidates(TowerData.OnlyImplicitReceiver(implicitReceiver))?.let { return it }
|
collectCandidates(TowerData.OnlyImplicitReceiver(implicitReceiver))?.let { return it }
|
||||||
}
|
}
|
||||||
|
// possible there is explicit member
|
||||||
|
collectCandidates(TowerData.Empty)?.let { return it }
|
||||||
|
|
||||||
for (level in context.scopeTower.levels) {
|
for (level in context.scopeTower.levels) {
|
||||||
collectCandidates(TowerData.TowerLevel(level))?.let { return it }
|
|
||||||
|
|
||||||
for (implicitReceiver in context.scopeTower.implicitReceivers) {
|
for (implicitReceiver in context.scopeTower.implicitReceivers) {
|
||||||
collectCandidates(TowerData.BothTowerLevelAndImplicitReceiver(level, implicitReceiver))?.let { return it }
|
collectCandidates(TowerData.BothTowerLevelAndImplicitReceiver(level, implicitReceiver))?.let { return it }
|
||||||
}
|
}
|
||||||
|
collectCandidates(TowerData.TowerLevel(level))?.let { return it }
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultCollector.getFinalCandidates()
|
return resultCollector.getFinalCandidates()
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ class B {
|
|||||||
~foo~fun foo() = 1
|
~foo~fun foo() = 1
|
||||||
~A.foo~fun A.foo() = 2
|
~A.foo~fun A.foo() = 2
|
||||||
|
|
||||||
fun A.bar() = `foo`foo()
|
fun A.bar() = `A.foo`foo()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,5 +2,5 @@
|
|||||||
~foo~fun foo() = 2
|
~foo~fun foo() = 2
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
fun test() = `foo`foo()
|
fun test() = `A.foo`foo()
|
||||||
}
|
}
|
||||||
+1
-1
@@ -5,7 +5,7 @@ class A {
|
|||||||
|
|
||||||
fun test(a: A) {
|
fun test(a: A) {
|
||||||
with (a) {
|
with (a) {
|
||||||
`simple`foo()
|
`extension`foo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user