[ModuleInterface] Don't print extensions of internal types (#19440)

This commit is contained in:
Jordan Rose
2018-09-26 14:57:23 -07:00
committed by GitHub
parent 639fb1df5a
commit b29f010510
2 changed files with 17 additions and 0 deletions

View File

@@ -109,6 +109,14 @@ PrintOptions PrintOptions::printTextualInterfaceFile() {
}
}
// Skip extensions that extend things we wouldn't print.
if (auto *ED = dyn_cast<ExtensionDecl>(D)) {
if (!shouldPrint(ED->getExtendedNominal(), options))
return false;
// FIXME: We also need to check the generic signature for constraints
// that we can't reference.
}
// Skip typealiases that just redeclare generic parameters.
if (auto *alias = dyn_cast<TypeAliasDecl>(D)) {
if (alias->isImplicit()) {

View File

@@ -102,3 +102,12 @@ extension PublicStruct {
// CHECK: public private(set) static var secretlySettable: Int{{$}}
public private(set) static var secretlySettable: Int = 0
} // CHECK: {{^[}]$}}
extension InternalStruct_BAD: PublicProto {
internal static var dummy: Int { return 0 }
}
// CHECK: extension UFIStruct : PublicProto {{[{]$}}
extension UFIStruct: PublicProto {
internal static var dummy: Int { return 0 }
} // CHECK-NEXT: {{^[}]$}}