Skip to content

Commit 4bd7bed

Browse files
committed
Update test case for @Concurrent capture diagnostics
1 parent 388fd1f commit 4bd7bed

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

test/Concurrency/concurrentfunction_capturediagnostics.swift

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,9 @@ struct NonTrivialValueType {
143143
func testCaseNonTrivialValue() {
144144
var i = NonTrivialValueType(17, Klass())
145145
f {
146-
// Currently emits a typechecker level error due to some sort of bug in the type checker.
147-
// print(i.i + 17)
148-
// print(i.i + 18)
149-
// print(i.i + 19)
146+
print(i.i + 17)
147+
print(i.i + 18)
148+
print(i.i + 19)
150149
}
151150

152151
i.i = 20
@@ -155,28 +154,27 @@ func testCaseNonTrivialValue() {
155154
// We only emit a warning here since we use the last write.
156155
//
157156
// TODO: Should we emit for all writes?
158-
i.i.addOne() // xpected-warning {{'i' mutated after capture by concurrent closure}}
159-
// xpected-note @-14 {{variable defined here}}
160-
// xpected-note @-14 {{variable captured by concurrent closure}}
161-
// xpected-note @-14 {{capturing use}}
162-
// xpected-note @-14 {{capturing use}}
163-
// xpected-note @-14 {{capturing use}}
157+
i.i.addOne() // expected-warning {{'i' mutated after capture by concurrent closure}}
158+
// expected-note @-14 {{variable defined here}}
159+
// expected-note @-14 {{variable captured by concurrent closure}}
160+
// expected-note @-14 {{capturing use}}
161+
// expected-note @-14 {{capturing use}}
162+
// expected-note @-14 {{capturing use}}
164163
}
165164

166165
func testCaseNonTrivialValueInout() {
167166
var i = NonTrivialValueType(17, Klass())
168167
f {
169-
// Currently emits a typechecker level error due to some sort of bug in the type checker.
170-
// print(i.i + 17)
171-
// print(i.k ?? "none")
168+
print(i.i + 17)
169+
print(i.k ?? "none")
172170
}
173171

174172
// We only emit a warning here since we use the last write.
175-
inoutUserOptKlass(&i.k) // xpected-warning {{'i' mutated after capture by concurrent closure}}
176-
// xpected-note @-8 {{variable defined here}}
177-
// xpected-note @-8 {{variable captured by concurrent closure}}
178-
// xpected-note @-8 {{capturing use}}
179-
// xpected-note @-8 {{capturing use}}
173+
inoutUserOptKlass(&i.k) // expected-warning {{'i' mutated after capture by concurrent closure}}
174+
// expected-note @-8 {{variable defined here}}
175+
// expected-note @-8 {{variable captured by concurrent closure}}
176+
// expected-note @-8 {{capturing use}}
177+
// expected-note @-8 {{capturing use}}
180178
}
181179

182180
protocol MyProt {
@@ -187,9 +185,8 @@ protocol MyProt {
187185
func testCaseAddressOnlyAllocBoxToStackable<T : MyProt>(i : T) {
188186
var i2 = i
189187
f {
190-
// Currently emits an error due to some sort of bug in the type checker.
191-
// print(i2.i + 17)
192-
// print(i2.k ?? "none")
188+
print(i2.i + 17)
189+
print(i2.k ?? "none")
193190
}
194191

195192
// TODO: Make sure we emit these once we support address only types!
@@ -206,9 +203,8 @@ func testCaseAddressOnlyNoAllocBoxToStackable<T : MyProt>(i : T) {
206203
let f2 = F()
207204
var i2 = i
208205
f2.useConcurrent {
209-
// Currently emits a typechecker level error due to some sort of bug in the type checker.
210-
// print(i2.i + 17)
211-
// print(i2.k ?? "none")
206+
print(i2.i + 17)
207+
print(i2.k ?? "none")
212208
}
213209

214210
// TODO: Make sure we emit these once we support address only types!

0 commit comments

Comments
 (0)