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