mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IDE] Only consider synthesized extensions when in the same module
Only declarations in the same module as synthesized extension's target are placed within a synthesized extension. We should thus not add "::SYNTHESIZED::" to the USR if the given declaration is in a different and. As an example, `Foundation` adds a method `components(separatedBy:)` to `String` through an extension on `StringProtocol`. But since it is within `Foundation` and not `Swift` it will *not* be in a synthesized extension of `String` or `StringProtocol`. So it should not have "::SYNTHESIZED::" added and should also not being in the `String` group. Resolves rdar://71355632.
This commit is contained in:
@@ -785,6 +785,7 @@ struct DeclInfo {
|
||||
const ValueDecl *OriginalProperty = nullptr;
|
||||
bool Unavailable = true;
|
||||
Type BaseType;
|
||||
/// Whether the \c VD is in a synthesized extension of \c BaseType
|
||||
bool InSynthesizedExtension = false;
|
||||
|
||||
DeclInfo(const ValueDecl *VD, Type ContainerType, bool IsRef, bool IsDynamic,
|
||||
@@ -810,9 +811,8 @@ struct DeclInfo {
|
||||
}
|
||||
|
||||
BaseType = findBaseTypeForReplacingArchetype(VD, ContainerType);
|
||||
InSynthesizedExtension = false;
|
||||
if (BaseType) {
|
||||
if (auto Target = BaseType->getAnyNominal()) {
|
||||
if (auto *Target = BaseType->getAnyNominal()) {
|
||||
SynthesizedExtensionAnalyzer Analyzer(
|
||||
Target, PrintOptions::printModuleInterface(
|
||||
Invoc.getFrontendOptions().PrintFullConvention));
|
||||
|
||||
Reference in New Issue
Block a user