File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ extension Task {
102
102
_taskLocalValuePush ( task, keyType: Key . self, value: value)
103
103
defer { _taskLocalValuePop ( task) }
104
104
105
- return try await body ( )
105
+ return try await operation ( )
106
106
}
107
107
108
108
}
Original file line number Diff line number Diff line change @@ -79,6 +79,20 @@ func simple_deinit() async {
79
79
try ! await printTaskLocal ( \. clazz) // CHECK: ClazzKey: nil {{.*}}
80
80
}
81
81
82
+ struct Boom : Error {
83
+ let value : String
84
+ }
85
+ func simple_throw( ) async {
86
+ do {
87
+ try await Task . withLocal ( \. clazz, boundTo: ClassTaskLocal ( ) ) {
88
+ throw Boom ( value: " oh no! " )
89
+ }
90
+ } catch {
91
+ //CHECK: error: Boom(value: "oh no!")
92
+ print ( " error: \( error) " )
93
+ }
94
+ }
95
+
82
96
func nested( ) async {
83
97
try ! await printTaskLocal ( \. string) // CHECK: StringKey: <undefined> {{.*}}
84
98
await Task . withLocal ( \. string, boundTo: " hello " ) {
@@ -132,13 +146,13 @@ func withLocal_body_mustNotEscape() async {
132
146
await Task . withLocal ( \. string, boundTo: " xxx " ) {
133
147
something = " very nice "
134
148
}
135
-
136
149
}
137
150
138
151
@main struct Main {
139
152
static func main( ) async {
140
153
await simple ( )
141
154
await simple_deinit ( )
155
+ await simple_throw ( )
142
156
await nested ( )
143
157
await nested_allContribute ( )
144
158
await nested_3_onlyTopContributes ( )
You can’t perform that action at this time.
0 commit comments