File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -2310,9 +2310,18 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
2310
2310
if (inst->isTypeDependentOperand (*use))
2311
2311
continue ;
2312
2312
switch (inst->getKind ()) {
2313
+ case SILInstructionKind::MarkDependenceInst:
2314
+ break ;
2313
2315
case SILInstructionKind::ApplyInst:
2314
2316
case SILInstructionKind::TryApplyInst:
2315
2317
case SILInstructionKind::PartialApplyInst:
2318
+ // Non-Mutating set pattern that allows a inout (that can't really
2319
+ // write back.
2320
+ if (auto *AI = dyn_cast<ApplyInst>(inst)) {
2321
+ if (isa<PointerToThinFunctionInst>(AI->getCallee ())) {
2322
+ break ;
2323
+ }
2324
+ }
2316
2325
if (isConsumingOrMutatingApplyUse (use))
2317
2326
return true ;
2318
2327
else
Original file line number Diff line number Diff line change @@ -416,6 +416,27 @@ func modifyProperty<T : PropertyWithGetterSetter>(_ x: inout T) {
416
416
// CHECK: [[TEMPORARY:%.*]] = address_to_pointer [[TEMPORARY_ADDR]] : $*Int to $Builtin.RawPointer
417
417
// CHECK: apply [[CALLBACK]]<T>
418
418
419
+ public struct Val {
420
+ public var x : Int = 0
421
+ }
422
+
423
+ public protocol Proto {
424
+ var val : Val { get nonmutating set }
425
+ }
426
+
427
+ public func test( _ p: Proto ) {
428
+ p. val. x += 1
429
+ }
430
+
431
+ // CHECK-LABEL: sil @$S9protocols4testyyAA5Proto_pF : $@convention(thin) (@in Proto) -> ()
432
+ // CHECK: [[OPEN:%.*]] = open_existential_addr immutable_access
433
+ // CHECK: [[MAT:%.*]] = witness_method $@opened("{{.*}}") Proto, #Proto.val!materializeForSet
434
+ // CHECK: [[BUF:%.*]] = apply [[MAT]]
435
+ // CHECK: [[WB:%.*]] = pointer_to_thin_function
436
+ // This use looks like it is mutating but really is not. We use to assert in the SIL verifier.
437
+ // CHECK: apply [[WB]]{{.*}}({{.*}}[[OPEN]]
438
+ // CHECK: return
439
+
419
440
// CHECK-LABEL: sil_witness_table hidden ClassWithGetter: PropertyWithGetter module protocols {
420
441
// CHECK-NEXT: method #PropertyWithGetter.a!getter.1: {{.*}} : @$S9protocols15ClassWithGetterCAA08PropertycD0A2aDP1aSivgTW
421
442
// CHECK-NEXT: }
You can’t perform that action at this time.
0 commit comments