@@ -272,10 +272,6 @@ extension __ExpectationContext where Output: ~Copyable {
272272 /// compile-time pressure on the type checker that we don't want.
273273 func captureDifferences< T, U> ( _ lhs: T , _ rhs: U , _ opID: __ExpressionID ) {
274274#if !hasFeature(Embedded) // no existentials
275- guard let lhs = lhs as? any BidirectionalCollection else {
276- return
277- }
278-
279275 func difference( ) -> CollectionDifference < Any > ? {
280276 if let lhs = lhs as? any StringProtocol {
281277 func open< V> ( _ lhs: V , _ rhs: U ) -> CollectionDifference < Any > ? where V: StringProtocol {
@@ -306,8 +302,7 @@ extension __ExpectationContext where Output: ~Copyable {
306302 // Do _not_ perform a diffing operation on `lhs` and `rhs`. Range
307303 // expressions are not usefully diffable the way other kinds of
308304 // collections are. SEE: https://github.com/swiftlang/swift-testing/issues/639
309- return nil
310- } else {
305+ } else if let lhs = lhs as? any BidirectionalCollection {
311306 func open< V> ( _ lhs: V , _ rhs: U ) -> CollectionDifference < Any > ? where V: BidirectionalCollection {
312307 guard let rhs = rhs as? V ,
313308 let elementType = V . Element. self as? any Equatable . Type else {
@@ -322,6 +317,7 @@ extension __ExpectationContext where Output: ~Copyable {
322317 }
323318 return open ( lhs, rhs)
324319 }
320+ return nil
325321 }
326322
327323 if differences == nil {
@@ -363,8 +359,7 @@ extension __ExpectationContext where Output: ~Copyable {
363359 let result = try op ( lhs, rhs)
364360 captureValue ( result, identifiedBy: opID)
365361
366- if !result,
367- #available( _castingWithNonCopyableGenerics, * ) ,
362+ if #available( _castingWithNonCopyableGenerics, * ) ,
368363 let lhs = makeExistential ( lhs) ,
369364 let rhs = makeExistential ( rhs) {
370365 captureDifferences ( lhs, rhs, opID)
0 commit comments