mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
swift-api-digester: avoid synthesizing nominal types from the same module.
Synthesizing types from the same module may bring back types that are not part the ABI/API, leading to false positives. Resolves: SR-9372
This commit is contained in:
@@ -96,3 +96,7 @@ infix operator ..*..
|
|||||||
class UsableFromInlineClass {
|
class UsableFromInlineClass {
|
||||||
private var Prop = 1
|
private var Prop = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class InternalType {}
|
||||||
|
|
||||||
|
extension InternalType {}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include <ModuleAnalyzerNodes.h>
|
#include <ModuleAnalyzerNodes.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -1522,7 +1523,11 @@ void SwiftDeclCollector::lookupVisibleDecls(ArrayRef<ModuleDecl *> Modules) {
|
|||||||
for (auto *D: KnownDecls) {
|
for (auto *D: KnownDecls) {
|
||||||
if (auto *Ext = dyn_cast<ExtensionDecl>(D)) {
|
if (auto *Ext = dyn_cast<ExtensionDecl>(D)) {
|
||||||
if (HandledExtensions.find(Ext) == HandledExtensions.end()) {
|
if (HandledExtensions.find(Ext) == HandledExtensions.end()) {
|
||||||
ExtensionMap[Ext->getExtendedNominal()].push_back(Ext);
|
auto *NTD = Ext->getExtendedNominal();
|
||||||
|
// Check if the extension is from other modules.
|
||||||
|
if (!llvm::is_contained(Modules, NTD->getModuleContext())) {
|
||||||
|
ExtensionMap[NTD].push_back(Ext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user