We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 91eec24 commit 62c4036Copy full SHA for 62c4036
validation-test/execution/sr9624.swift
@@ -0,0 +1,29 @@
1
+// RUN: %target-run-simple-swift | %FileCheck %s
2
+// REQUIRES: executable_test
3
+
4
+protocol P {
5
+ associatedtype T
6
+ func foo(t: inout T)
7
+}
8
+struct S: P {
9
+ func foo(t: inout () -> Void) {
10
+ t()
11
+ t = { print("new") }
12
+ }
13
14
15
+func doTheFoo<SomeP: P>(_ p: SomeP, _ value: SomeP.T) -> SomeP.T {
16
+ var mutableValue = value
17
+ p.foo(t: &mutableValue)
18
+ return mutableValue
19
20
21
+print("START")
22
+let newClosure = doTheFoo(S(), { print("old") })
23
+newClosure()
24
+print("DONE")
25
26
+// CHECK: START
27
+// CHECK-NEXT: old
28
+// CHECK-NEXT: new
29
+// CHECK-NEXT: DONE
0 commit comments