@@ -83,6 +83,17 @@ ArrayTraps.test("bounds_with_downcast")
83
83
_ = da [ 2 ]
84
84
}
85
85
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 }
94
+ return true
95
+ }
96
+
86
97
var ArraySemanticOptzns = TestSuite ( " ArraySemanticOptzns " + testSuiteSuffix)
87
98
88
99
class BaseClass {
@@ -131,8 +142,11 @@ ArraySemanticOptzns.test("inout_rule_violated_isNativeBuffer")
131
142
. skip ( . custom(
132
143
{ _isFastAssertConfiguration ( ) } ,
133
144
reason: " this trap is not guaranteed to happen in -Ounchecked " ) )
134
- . crashOutputMatches ( _isDebugAssertConfiguration ( ) ?
135
- " Fatal access conflict detected. " : " " )
145
+ . crashOutputMatches (
146
+ !_isDebugAssertConfiguration( ) ? " "
147
+ : hasBackdeployedConcurrencyRuntime ( ) ? " inout rules were violated "
148
+ : " Fatal access conflict detected. "
149
+ )
136
150
. code {
137
151
let v = ViolateInoutSafetySwitchToObjcBuffer ( )
138
152
expectCrashLater ( )
@@ -174,8 +188,11 @@ ArraySemanticOptzns.test("inout_rule_violated_needsElementTypeCheck")
174
188
. skip ( . custom(
175
189
{ _isFastAssertConfiguration ( ) } ,
176
190
reason: " this trap is not guaranteed to happen in -Ounchecked " ) )
177
- . crashOutputMatches ( _isDebugAssertConfiguration ( ) ?
178
- " Fatal access conflict detected. " : " " )
191
+ . crashOutputMatches (
192
+ !_isDebugAssertConfiguration( ) ? " "
193
+ : hasBackdeployedConcurrencyRuntime ( ) ? " inout rules were violated "
194
+ : " Fatal access conflict detected. "
195
+ )
179
196
. code {
180
197
let v = ViolateInoutSafetyNeedElementTypeCheck ( )
181
198
expectCrashLater ( )
0 commit comments