Open
Description
Currently, if you have a module & a type within that module with the same name, you'll be in trouble if some other module also has that type.
Example:
// main
import Foo
import Bar
Foo.Foo()
// MODULE: Foo
public struct Foo {
public init() {
print("Foo.Foo")
}
}
// MODULE: Bar
public struct Foo {
public init() {
print("Foo.Foo")
}
}
Error:
TestApp/main.swift:5:5: error: reference to member 'Foo' cannot be resolved without a contextual type
Foo.Foo()
^
Yes, I know you can resort to
// main
import Foo
import Bar
import struct Foo.Foo // <-- this is the disambiguation
Foo()
but that's cumbersome and undiscoverable.