Skip to content

Commit 3f44b65

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-rebranch
2 parents 2ff5de5 + 66a2f62 commit 3f44b65

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

lib/SILGen/SILGenLValue.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,8 +1431,6 @@ namespace {
14311431
// Create the allocating setter function. It captures the base address.
14321432
auto setterInfo = SGF.getConstantInfo(setter);
14331433
SILValue setterFRef = SGF.emitGlobalFunctionRef(loc, setter, setterInfo);
1434-
auto setterSubs = SGF.getFunction().getForwardingSubstitutionMap();
1435-
14361434
CanSILFunctionType setterTy = setterFRef->getType().castTo<SILFunctionType>();
14371435
SILFunctionConventions setterConv(setterTy, SGF.SGM.M);
14381436

@@ -1446,7 +1444,7 @@ namespace {
14461444

14471445
PartialApplyInst *setterPAI =
14481446
SGF.B.createPartialApply(loc, setterFRef,
1449-
setterSubs, { capturedBase },
1447+
Substitutions, { capturedBase },
14501448
ParameterConvention::Direct_Guaranteed);
14511449
ManagedValue setterFn = SGF.emitManagedRValueWithCleanup(setterPAI);
14521450

test/SILOptimizer/di_property_wrappers.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ struct IntStruct {
6161
}
6262
wrapped = 27
6363
}
64+
65+
// Check that we don't crash if the function has unrelated generic parameters.
66+
// SR-11484
67+
mutating func setit<V>(_ v: V) {
68+
wrapped = 5
69+
}
6470
}
6571

6672
final class IntClass {
@@ -142,10 +148,15 @@ func testIntStruct() {
142148

143149
// CHECK-NEXT: .. init 42
144150
// CHECK-NEXT: .. set 27
145-
let t1 = IntStruct()
151+
var t1 = IntStruct()
146152
// CHECK-NEXT: 27
147153
print(t1.wrapped)
148154

155+
// CHECK-NEXT: .. set 5
156+
t1.setit(false)
157+
// CHECK-NEXT: 5
158+
print(t1.wrapped)
159+
149160
// CHECK-NEXT: .. init 42
150161
let t2 = IntStruct(conditional: false)
151162
// CHECK-NEXT: 42

0 commit comments

Comments
 (0)