Skip to content

Commit 20b99f3

Browse files
Merge pull request #60009 from nate-chandler/rdar96194366
[IRGen] Look through opaque types for protocol witness table lazy access function.
2 parents 6907b10 + f454717 commit 20b99f3

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)