mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ModuleInterface] Don't print extensions to implementation-only imported types
Extensions to implementation-only types are accepted at type-checking only if they don't define any public members. However if they declared a conformance to a public type they were also printed in the swiftinterface, making it unparsable because of an unknown type. Still accept such extensions but don't print them. rdar://problem/67516588
This commit is contained in:
@@ -1994,6 +1994,27 @@ bool SourceFile::isImportedImplementationOnly(const ModuleDecl *module) const {
|
||||
return !imports.isImportedBy(module, getParentModule());
|
||||
}
|
||||
|
||||
bool ModuleDecl::isImportedImplementationOnly(const ModuleDecl *module) const {
|
||||
auto &imports = getASTContext().getImportCache();
|
||||
|
||||
// Look through non-implementation-only imports to see if module is imported
|
||||
// in some other way. Otherwise we assume it's implementation-only imported.
|
||||
ModuleDecl::ImportFilter filter = {
|
||||
ModuleDecl::ImportFilterKind::Public,
|
||||
ModuleDecl::ImportFilterKind::Private,
|
||||
ModuleDecl::ImportFilterKind::SPIAccessControl,
|
||||
ModuleDecl::ImportFilterKind::ShadowedBySeparateOverlay};
|
||||
SmallVector<ModuleDecl::ImportedModule, 4> results;
|
||||
getImportedModules(results, filter);
|
||||
|
||||
for (auto &desc : results) {
|
||||
if (imports.isImportedBy(module, desc.importedModule))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SourceFile::lookupImportedSPIGroups(
|
||||
const ModuleDecl *importedModule,
|
||||
llvm::SmallSetVector<Identifier, 4> &spiGroups) const {
|
||||
|
||||
Reference in New Issue
Block a user