Skip to content

Commit 06d4469

Browse files
authored
Merge pull request #3859 from swiftwasm/main
[pull] swiftwasm from main
2 parents 5978205 + f213272 commit 06d4469

File tree

3 files changed

+25
-67
lines changed

3 files changed

+25
-67
lines changed

test/stdlib/KVOKeyPaths.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,6 @@ testObjectForOptionalKeyPath.optionalObject = nil
215215
testObjectForOptionalKeyPath.optionalObject = "foo"
216216

217217
// CHECK-51-LABEL: observe keyPath with optional value
218-
// CHECK-51-NEXT: oldValue = Optional(nil), newValue = {{Optional\(nil\)|nil}}
219-
// CHECK-51-NEXT: oldValue = Optional(nil), newValue = {{Optional\(nil\)|nil}}
220-
// CHECK-51-NEXT: oldValue = Optional(nil), newValue = Optional(Optional("foo"))
218+
// CHECK-51-NEXT: oldValue = {{Optional\(nil\)|nil}}, newValue = {{Optional\(nil\)|nil}}
219+
// CHECK-51-NEXT: oldValue = {{Optional\(nil\)|nil}}, newValue = {{Optional\(nil\)|nil}}
220+
// CHECK-51-NEXT: oldValue = {{Optional\(nil\)|nil}}, newValue = Optional(Optional("foo"))

validation-test/stdlib/ArrayTrapsObjC.swift

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ ArrayTraps.test("bounds_with_downcast")
8383
_ = da[2]
8484
}
8585

86+
func hasBackdeployedConcurrencyRuntime() -> Bool {
87+
// If the stdlib we've loaded predates Swift 5.5, then we're running on a back
88+
// deployed concurrency runtime, which has the side effect of disabling
89+
// regular runtime exclusivity checks.
90+
//
91+
// This makes the two tests below fall back to older, higher-level exclusivity
92+
// checks in the stdlib, which will still trap, but with a different message.
93+
if #available(SwiftStdlib 5.5, *) { return false } // recent enough production stdlib
94+
if #available(SwiftStdlib 9999, *) { return false } // dev stdlib
95+
return true
96+
}
97+
8698
var ArraySemanticOptzns = TestSuite("ArraySemanticOptzns" + testSuiteSuffix)
8799

88100
class BaseClass {
@@ -131,8 +143,11 @@ ArraySemanticOptzns.test("inout_rule_violated_isNativeBuffer")
131143
.skip(.custom(
132144
{ _isFastAssertConfiguration() },
133145
reason: "this trap is not guaranteed to happen in -Ounchecked"))
134-
.crashOutputMatches(_isDebugAssertConfiguration() ?
135-
"Fatal access conflict detected." : "")
146+
.crashOutputMatches(
147+
!_isDebugAssertConfiguration() ? ""
148+
: hasBackdeployedConcurrencyRuntime() ? "inout rules were violated"
149+
: "Fatal access conflict detected."
150+
)
136151
.code {
137152
let v = ViolateInoutSafetySwitchToObjcBuffer()
138153
expectCrashLater()
@@ -174,8 +189,11 @@ ArraySemanticOptzns.test("inout_rule_violated_needsElementTypeCheck")
174189
.skip(.custom(
175190
{ _isFastAssertConfiguration() },
176191
reason: "this trap is not guaranteed to happen in -Ounchecked"))
177-
.crashOutputMatches(_isDebugAssertConfiguration() ?
178-
"Fatal access conflict detected." : "")
192+
.crashOutputMatches(
193+
!_isDebugAssertConfiguration() ? ""
194+
: hasBackdeployedConcurrencyRuntime() ? "inout rules were violated"
195+
: "Fatal access conflict detected."
196+
)
179197
.code {
180198
let v = ViolateInoutSafetyNeedElementTypeCheck()
181199
expectCrashLater()

validation-test/stdlib/SetOperations.swift.gyb

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -248,66 +248,6 @@ suite.test("symmetricDifference.${inputKind}.${argumentKind}") {
248248
% end
249249
% end
250250

251-
% for inputKind, inputGenerator in inputKinds.items():
252-
% for argumentKind, argumentGenerator in argumentKinds.items():
253-
% needsCocoa = inputKind == "cocoa" or argumentKind == "cocoa"
254-
% if needsCocoa:
255-
#if _runtime(_ObjC)
256-
% end
257-
suite.test("formIntersection.${inputKind}.${argumentKind}") {
258-
var a = ${inputGenerator}(0 ..< 10, identity: 1)
259-
let b = ${argumentGenerator}(5 ..< 15, identity: 2)
260-
a.formSymmetricDifference(b)
261-
expectTrue(isNativeSet(a))
262-
expectEqual(a.count, 10)
263-
// Check the resulting items and that they come from the correct input set.
264-
for v in 5 ..< 10 {
265-
expectFalse(a.contains(Value(v)), "Found \(v) in result")
266-
}
267-
for v in Array(0 ..< 5) + Array(10 ..< 15) {
268-
guard let i = a.firstIndex(of: Value(v)) else {
269-
expectTrue(false, "Could not find \(v) in result")
270-
continue
271-
}
272-
expectEqual(a[i].identity, v < 5 ? 1 : 2)
273-
}
274-
}
275-
% if needsCocoa:
276-
#endif
277-
% end
278-
% end
279-
% end
280-
281-
% for inputKind, inputGenerator in inputKinds.items():
282-
% for argumentKind, argumentGenerator in argumentKinds.items():
283-
% needsCocoa = inputKind == "cocoa" or argumentKind == "cocoa"
284-
% if needsCocoa:
285-
#if _runtime(_ObjC)
286-
% end
287-
suite.test("symmetricDifference.${inputKind}.${argumentKind}") {
288-
let a = ${inputGenerator}(0 ..< 10, identity: 1)
289-
let b = ${argumentGenerator}(5 ..< 15, identity: 2)
290-
let c = a.symmetricDifference(b)
291-
expectTrue(isNativeSet(c))
292-
expectEqual(c.count, 10)
293-
// Check the resulting items and that they come from the correct input set.
294-
for v in 5 ..< 10 {
295-
expectFalse(c.contains(Value(v)), "Found \(v) in result")
296-
}
297-
for v in Array(0 ..< 5) + Array(10 ..< 15) {
298-
guard let i = c.firstIndex(of: Value(v)) else {
299-
expectTrue(false, "Could not find \(v) in result")
300-
continue
301-
}
302-
expectEqual(c[i].identity, v < 5 ? 1 : 2)
303-
}
304-
}
305-
% if needsCocoa:
306-
#endif
307-
% end
308-
% end
309-
% end
310-
311251
% for inputKind, inputGenerator in inputKinds.items():
312252
% for argumentKind, argumentGenerator in argumentKinds.items():
313253
% needsCocoa = inputKind == "cocoa" or argumentKind == "cocoa"

0 commit comments

Comments
 (0)