@@ -16,41 +16,21 @@ func _recordIssue(
16
16
else {
17
17
#if DEBUG
18
18
guard
19
- let fromSyntaxNode = unsafeBitCast (
20
- symbol: " $s7Testing12__ExpressionV16__fromSyntaxNodeyACSSFZ " ,
21
- in: " Testing " ,
22
- to: ( @convention( thin) ( String) - > __Expression) . self
23
- ) ,
24
- let checkValue = unsafeBitCast (
25
- symbol: """
26
- $s7Testing12__checkValue_10expression0D25WithCapturedRuntimeValues26mismatchedErrorDesc \
27
- ription10difference8comments10isRequired14sourceLocations6ResultOyyts0J0_pGSb_AA12__Exp \
28
- ressionVAOSgyXKSSSgyXKAQyXKSayAA7CommentVGyXKSbAA06SourceQ0VtF
29
- """ ,
19
+ let record = unsafeBitCast (
20
+ symbol: " $s7Testing5IssueV6record_14sourceLocationAcA7CommentVSg_AA06SourceE0VtFZ " ,
30
21
in: " Testing " ,
31
- to: ( @convention( thin) (
32
- Bool,
33
- __Expression,
34
- @autoclosure ( ) - > __Expression? ,
35
- @autoclosure ( ) - > String? ,
36
- @autoclosure ( ) - > String? ,
37
- @autoclosure ( ) - > [ Any] ,
38
- Bool,
39
- SourceLocation
40
- ) - > Result< Void, any Error> )
41
- . self
22
+ to: ( @convention( thin) ( Any? , SourceLocation) - > Issue) . self
42
23
)
43
24
else { return }
44
25
45
- let syntaxNode = fromSyntaxNode ( message ?? " " )
46
- _ = checkValue (
47
- false ,
48
- syntaxNode,
49
- nil ,
50
- nil ,
51
- nil ,
52
- [ ] ,
53
- false ,
26
+ var comment : Any ?
27
+ if let message {
28
+ var c = UnsafeMutablePointer < Comment > . allocate ( capacity: 1 ) . pointee
29
+ c. rawValue = message
30
+ comment = c
31
+ }
32
+ _ = record (
33
+ comment,
54
34
SourceLocation ( fileID: fileID, _filePath: filePath, line: line, column: column)
55
35
)
56
36
#else
@@ -87,7 +67,7 @@ func _recordError(
87
67
$s7Testing5IssueV6record__14sourceLocationACs5Error_p_AA7CommentVSgAA06SourceE0VtFZ
88
68
""" ,
89
69
in: " Testing " ,
90
- to: ( @convention ( thin) ( any Error , Any? , SourceLocation) - > Any ) . self
70
+ to: ( @convention ( thin) ( any Error , Any? , SourceLocation) - > Issue ) . self
91
71
)
92
72
else { return }
93
73
@@ -310,19 +290,9 @@ func _currentTestIsNotNil() -> Bool {
310
290
var runtimeValue : Value ?
311
291
}
312
292
313
- private struct TypeInfo: Sendable {
314
- enum _Kind : Sendable {
315
- case type( _ type: Any . Type )
316
- case nameOnly( fullyQualifiedComponents: [ String ] , unqualified: String , mangled: String ? )
317
- }
318
- var _kind : _Kind
319
- }
320
-
321
- private struct SourceLocation: Sendable {
322
- var fileID : String
323
- var _filePath : String
324
- var line : Int
325
- var column : Int
293
+ private struct Backtrace: Sendable {
294
+ typealias Address = UInt64
295
+ var addresses : [ Address ]
326
296
}
327
297
328
298
private struct Comment: RawRepresentable, Sendable {
@@ -342,7 +312,48 @@ func _currentTestIsNotNil() -> Bool {
342
312
var kind : Kind ?
343
313
}
344
314
345
- private protocol Trait: Sendable { }
315
+ private struct Confirmation: Sendable {
316
+ protocol ExpectedCount: Sendable , RangeExpression< Int> { }
317
+ }
318
+
319
+ private struct Expectation: Sendable {
320
+ var evaluatedExpression : __Expression
321
+ var mismatchedErrorDescription : String ?
322
+ var differenceDescription : String ?
323
+ var mismatchedExitConditionDescription : String ?
324
+ var isPassing : Bool
325
+ var isRequired : Bool
326
+ var sourceLocation : SourceLocation
327
+ }
328
+
329
+ private struct Issue: Sendable {
330
+ enum Kind : Sendable {
331
+ case unconditional
332
+ indirect case expectationFailed( _ expectation: Expectation )
333
+ indirect case confirmationMiscounted( actual: Int , expected: Int )
334
+ indirect case confirmationOutOfRange( actual: Int , expected: any Confirmation . ExpectedCount )
335
+ indirect case errorCaught( _ error: any Error )
336
+ indirect case timeLimitExceeded( timeLimitComponents: ( seconds: Int64 , attoseconds: Int64 ) )
337
+ case knownIssueNotRecorded
338
+ case apiMisused
339
+ case system
340
+ }
341
+ var kind : Kind
342
+ var comments : [ Comment ]
343
+ var sourceContext : SourceContext
344
+ }
345
+
346
+ private struct SourceContext: Sendable {
347
+ var backtrace : Backtrace ?
348
+ var sourceLocation : SourceLocation ?
349
+ }
350
+
351
+ private struct SourceLocation: Sendable {
352
+ var fileID : String
353
+ var _filePath : String
354
+ var line : Int
355
+ var column : Int
356
+ }
346
357
347
358
struct Test: @unchecked Sendable {
348
359
static var current: Self ? {
@@ -378,6 +389,16 @@ func _currentTestIsNotNil() -> Bool {
378
389
}
379
390
private var isSynthesized = false
380
391
}
392
+
393
+ private protocol Trait: Sendable { }
394
+
395
+ private struct TypeInfo: Sendable {
396
+ enum _Kind : Sendable {
397
+ case type( _ type: Any . Type )
398
+ case nameOnly( fullyQualifiedComponents: [ String ] , unqualified: String , mangled: String ? )
399
+ }
400
+ var _kind : _Kind
401
+ }
381
402
#endif
382
403
383
404
@usableFromInline
0 commit comments