File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1384,7 +1384,9 @@ namespace {
1384
1384
assert (getAccessorDecl ()->isSetter ());
1385
1385
SILDeclRef setter = Accessor;
1386
1386
1387
- if (hasPropertyWrapper () && IsOnSelfParameter &&
1387
+ if (IsOnSelfParameter &&
1388
+ !Storage->isStatic () &&
1389
+ hasPropertyWrapper () &&
1388
1390
isBackingVarVisible (cast<VarDecl>(Storage),
1389
1391
SGF.FunctionDC )) {
1390
1392
// This is wrapped property. Instead of emitting a setter, emit an
Original file line number Diff line number Diff line change @@ -569,6 +569,21 @@ struct WrappedIntContainer {
569
569
@WrappedInt var int : Int ?
570
570
}
571
571
572
+ // rdar://problem/59117087 - crash due to incorrectly taking the "self access"
573
+ // path for a static property with a wrapper
574
+
575
+ struct HasStaticWrapper {
576
+ @StructWrapper static var staticWrapper : Int = 0
577
+
578
+ // CHECK-LABEL: sil hidden [ossa] @$s17property_wrappers16HasStaticWrapperV08assignToD4SelfyyFZ : $@convention(method) (@thin HasStaticWrapper.Type) -> () {
579
+ static func assignToStaticSelf( ) {
580
+ // Make sure we call the setter instead of attempting a direct access,
581
+ // like we would if the property was not static:
582
+
583
+ // CHECK: function_ref @$s17property_wrappers16HasStaticWrapperV06staticE0SivsZ : $@convention(method) (Int, @thin HasStaticWrapper.Type) -> ()
584
+ staticWrapper = 1
585
+ }
586
+ }
572
587
573
588
// CHECK-LABEL: sil_vtable ClassUsingWrapper {
574
589
// CHECK-NEXT: #ClassUsingWrapper.x!getter.1: (ClassUsingWrapper) -> () -> Int : @$s17property_wrappers17ClassUsingWrapperC1xSivg // ClassUsingWrapper.x.getter
You can’t perform that action at this time.
0 commit comments