File tree Expand file tree Collapse file tree 2 files changed +26
-8
lines changed
Expand file tree Collapse file tree 2 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -748,16 +748,17 @@ SILLinkage LinkEntity::getLinkage(ForDefinition_t forDefinition) const {
748748 case Kind::OpaqueTypeDescriptor: {
749749 auto *opaqueType = cast<OpaqueTypeDecl>(getDecl ());
750750
751- // The opaque result type descriptor with availability conditions
752- // has to be emitted into a client module when associated with
751+ // With conditionally available substitutions, the opaque result type
752+ // descriptor has to be emitted into a client module when associated with
753753 // `@_alwaysEmitIntoClient` declaration which means it's linkage
754754 // has to be "shared".
755- if (opaqueType->hasConditionallyAvailableSubstitutions ()) {
756- if (auto *srcDecl = opaqueType->getNamingDecl ()) {
757- if (srcDecl->getAttrs ().hasAttribute <AlwaysEmitIntoClientAttr>())
758- return SILLinkage::Shared;
759- }
760- }
755+ //
756+ // If we don't have conditionally available substitutions, we won't emit
757+ // the descriptor at all, but still make sure we report "shared" linkage
758+ // so that TBD files don't include a bogus symbol.
759+ auto *srcDecl = opaqueType->getNamingDecl ();
760+ if (srcDecl->getAttrs ().hasAttribute <AlwaysEmitIntoClientAttr>())
761+ return SILLinkage::Shared;
761762
762763 return getSILLinkage (getDeclLinkage (opaqueType), forDefinition);
763764 }
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+ // RUN: %target-swift-frontend -resolve-imports -emit-tbd -emit-tbd-path %t/resolve_imports.tbd %s -disable-availability-checking
3+ // RUN: %FileCheck %s < %t/resolve_imports.tbd
4+
5+ // REQUIRES: OS=macosx
6+
7+ @_alwaysEmitIntoClient public var x : some Any {
8+ get {
9+ if #available( macOS 20 , * ) {
10+ return 3
11+ } else {
12+ return " hi "
13+ }
14+ }
15+ }
16+
17+ // CHECK: symbols: [ _main ]
You can’t perform that action at this time.
0 commit comments