Skip to content

Commit 9972814

Browse files
committed
[SIL] Prevent emitting descriptors for static properties in protocol extensions.
1 parent 87c1613 commit 9972814

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/SIL/IR/SIL.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,12 @@ bool AbstractStorageDecl::exportsPropertyDescriptor() const {
369369
// Protocol requirements do not need property descriptors.
370370
if (isa<ProtocolDecl>(getDeclContext()))
371371
return false;
372-
372+
373+
// Static properties in protocol extensions do not need
374+
// descriptors as existential Any.Type will not resolve to a value.
375+
if (isStatic() && getDeclContext()->getSelfProtocolDecl())
376+
return false;
377+
373378
// FIXME: We should support properties and subscripts with '_read' accessors;
374379
// 'get' is not part of the opaque accessor set there.
375380
auto *getter = getOpaqueAccessor(AccessorKind::Get);

0 commit comments

Comments
 (0)