@@ -345,36 +345,12 @@ final class PredicateTests: XCTestCase {
345345 }
346346
347347 let date = Date . now
348- let predicate = Predicate< Object> {
349- /*
350- if let num = $0.a as? Int {
351- num == 3
352- } else {
353- $0.h == date
354- }
355- */
356- PredicateExpressions . build_NilCoalesce (
357- lhs: PredicateExpressions . build_flatMap (
358- PredicateExpressions . ConditionalCast < _ , Int > (
359- PredicateExpressions . build_KeyPath (
360- root: PredicateExpressions . build_Arg ( $0) ,
361- keyPath: \. a
362- )
363- )
364- ) { num in
365- PredicateExpressions . build_Equal (
366- lhs: PredicateExpressions . build_Arg ( num) ,
367- rhs: PredicateExpressions . build_Arg ( 3 )
368- )
369- } ,
370- rhs: PredicateExpressions . build_Equal (
371- lhs: PredicateExpressions . build_KeyPath (
372- root: PredicateExpressions . build_Arg ( $0) ,
373- keyPath: \. h
374- ) ,
375- rhs: PredicateExpressions . build_Arg ( date)
376- )
377- )
348+ let predicate = #Predicate< Object> {
349+ if let num = $0. i as? Int {
350+ num == 3
351+ } else {
352+ $0. h == date
353+ }
378354 }
379355#if FOUNDATION_FRAMEWORK
380356 let moduleName = " Foundation "
@@ -389,7 +365,7 @@ final class PredicateTests: XCTestCase {
389365 capture1 (Swift.Int): 3
390366 capture2 ( \( moduleName) .Date): <Date \( date. timeIntervalSince1970) >
391367 Predicate< \( testModuleName) .PredicateTests.Object> { input1 in
392- (input1.a as? Swift.Int).flatMap({ variable1 in
368+ (input1.i as? Swift.Int).flatMap({ variable1 in
393369 variable1 == capture1
394370 }) ?? (input1.h == capture2)
395371 }
@@ -399,7 +375,7 @@ final class PredicateTests: XCTestCase {
399375 let debugDescription = predicate. debugDescription. replacing ( #/Variable\([0-9]+\)/# , with: " Variable(#) " )
400376 XCTAssertEqual (
401377 debugDescription,
402- " \( moduleName) .Predicate<Pack{ \( testModuleName) .PredicateTests.Object}>(variable: (Variable(#)), expression: NilCoalesce(lhs: OptionalFlatMap(wrapped: ConditionalCast(input: KeyPath(root: Variable(#), keyPath: \\ Object.a ), desiredType: Swift.Int), variable: Variable(#), transform: Equal(lhs: Variable(#), rhs: Value<Swift.Int>(3))), rhs: Equal(lhs: KeyPath(root: Variable(#), keyPath: \\ Object.h), rhs: Value< \( moduleName) .Date>( \( date. debugDescription) )))) "
378+ " \( moduleName) .Predicate<Pack{ \( testModuleName) .PredicateTests.Object}>(variable: (Variable(#)), expression: NilCoalesce(lhs: OptionalFlatMap(wrapped: ConditionalCast(input: KeyPath(root: Variable(#), keyPath: \\ Object.i ), desiredType: Swift.Int), variable: Variable(#), transform: Equal(lhs: Variable(#), rhs: Value<Swift.Int>(3))), rhs: Equal(lhs: KeyPath(root: Variable(#), keyPath: \\ Object.h), rhs: Value< \( moduleName) .Date>( \( date. debugDescription) )))) "
403379 )
404380 }
405381}
0 commit comments