mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CodeCompletion] Don't emit member type construction for the same type
in unresolved member completion. e.g.
struct Node {
typealias Child = Node
init(children: [Child]) {}
}
let node: Node = .#^COMPLETE^#
This used to emit `.init(children:)` and `.Child(children:)`.
This commit is contained in:
@@ -3825,7 +3825,12 @@ public:
|
||||
// convertible to the contextual type.
|
||||
if (auto CD = dyn_cast<TypeDecl>(VD)) {
|
||||
declTy = declTy->getMetatypeInstanceType();
|
||||
return declTy->isEqual(T) || swift::isConvertibleTo(declTy, T, *DC);
|
||||
|
||||
// Emit construction for the same type via typealias doesn't make sense
|
||||
// because we are emitting all `.init()`s.
|
||||
if (declTy->isEqual(T))
|
||||
return false;
|
||||
return swift::isConvertibleTo(declTy, T, *DC);
|
||||
}
|
||||
|
||||
// Only static member can be referenced.
|
||||
|
||||
Reference in New Issue
Block a user