Are you suggesting that we might want to always include outer-scope functions as candidates, even when an inner-scope function with matching name is found? I had been under the impression that such a change was a non-starter on account of it being source-breaking.
For example, do you envision the following becoming valid?
func foo(_ n: Int) {}
struct Bar {
func foo(_ s: String) {}
func test() { foo(2) }
}
And do you envision the following to start printing “Outer” if Bar().test()
is called?
func foo(_ n: Int) { print("Outer") }
struct Bar {
func foo<T: Numeric>(_ t: T) { print("Inner") }
func test() { foo(2) }
}
In contrast, the approach I described would not affect either of these examples. The first would fail to compile, and the second would print “Inner”, just as they do today.