Skip to content

Commit feb5bc2

Browse files
nate-chandlerhborla
authored andcommitted
[IRGen] Look through opaque types for protocol witness table lazy access function.
When determining the linkage of protocol witness table lazy access functions and their cache variables, look through opaque types to find the underlying decls. rdar://96194366
1 parent 1a256ff commit feb5bc2

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

lib/IRGen/Linking.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,13 @@ SILLinkage LinkEntity::getLinkage(ForDefinition_t forDefinition) const {
765765

766766
case Kind::ProtocolWitnessTableLazyAccessFunction:
767767
case Kind::ProtocolWitnessTableLazyCacheVariable: {
768-
auto *nominal = getType().getAnyNominal();
768+
auto ty = getType();
769+
ValueDecl *nominal = nullptr;
770+
if (auto *otat = ty->getAs<OpaqueTypeArchetypeType>()) {
771+
nominal = otat->getDecl();
772+
} else {
773+
nominal = ty->getAnyNominal();
774+
}
769775
assert(nominal);
770776
if (getDeclLinkage(nominal) == FormalLinkage::Private ||
771777
getLinkageAsConformance() == SILLinkage::Private) {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %target-swift-frontend -target %target-cpu-apple-macosx10.15 -swift-version 5 -c %s
2+
// REQUIRES: objc_interop
3+
// REQUIRES: OS=macosx
4+
5+
import SwiftUI
6+
7+
struct DropDestinationCoordinatorView: NSViewRepresentable {
8+
func makeNSView(context: Context) -> some NSView {
9+
return NSView()
10+
}
11+
12+
func updateNSView(_ nsView: NSViewType, context: Context) {
13+
print("for view: \(nsView)")
14+
}
15+
}
16+

0 commit comments

Comments
 (0)