Skip to content

Commit ef96728

Browse files
committed
[SIL] Prevent emitting descriptors for static properties in protocol extensions.
1 parent c710950 commit ef96728

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
@@ -370,7 +370,12 @@ bool AbstractStorageDecl::exportsPropertyDescriptor() const {
370370
// Protocol requirements do not need property descriptors.
371371
if (isa<ProtocolDecl>(getDeclContext()))
372372
return false;
373-
373+
374+
// Static properties in protocol extensions do not need
375+
// descriptors as existential Any.Type will not resolve to a value.
376+
if (isStatic() && getDeclContext()->getSelfProtocolDecl())
377+
return false;
378+
374379
// FIXME: We should support properties and subscripts with '_read' accessors;
375380
// 'get' is not part of the opaque accessor set there.
376381
auto *getter = getOpaqueAccessor(AccessorKind::Get);

0 commit comments

Comments
 (0)