swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.57k stars 10.35k forks source link

[SR-4469] Code completion for ambiguous types that must be qualified #47046

Open rxwei opened 7 years ago

rxwei commented 7 years ago
Previous ID SR-4469
Radar None
Original Reporter @rxwei
Type Improvement
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | CodeCompletion | |Labels | Improvement | |Assignee | None | |Priority | Medium | md5: 403e74e4b6c440616789b7924617f04e

Issue Description:

/// module ModuleA:
struct Foo {}

/// module ModuleB:
struct Foo {}

/// module C:
import A
import B
/// From this point, any use of Foo type must be qualified
protocol Fruit {
    associatedtype T
    func bar() -> T
}
struct Apple : Fruit {
    typealias T = ModuleB.Foo

    /// Use code completion for `func bar` here in Xcode...
    /// Completion result, unqualified
    func bar() -> Foo
    /// Diagnostics keep saying 'cannot match `() -> Foo` with `() -> Foo`' and 'does not conform to protocol Fruit'
}

I would expect code completion to use the qualified name since 1. typealias declaration is already qualified by the programmer 2. `Foo` must be qualified

belkadan commented 7 years ago

cc @nkcsgexi