@@ -303,7 +303,12 @@ extension UnicodeScalar : Arbitrary {
303
303
/// The default shrinking function for `UnicodeScalar` values.
304
304
public static func shrink( _ x : UnicodeScalar ) -> [ UnicodeScalar ] {
305
305
let s : UnicodeScalar = UnicodeScalar ( UInt32 ( tolower ( Int32 ( x. value) ) ) ) !
306
- return [ " a " , " b " , " c " , s, " A " , " B " , " C " , " 1 " , " 2 " , " 3 " , " \n " , " " ] . nub. filter { $0 < x }
306
+ let scalarSet = Set < UnicodeScalar > ( [ " a " , " b " , " c " , " A " , " B " , " C " , " 1 " , " 2 " , " 3 " , " \n " , " " ] )
307
+ if scalarSet. contains ( s) {
308
+ return [ " a " , " b " , " c " , " A " , " B " , " C " , " 1 " , " 2 " , " 3 " , " \n " , " " ] . filter { $0 < x }
309
+ } else {
310
+ return [ " a " , " b " , " c " , s, " A " , " B " , " C " , " 1 " , " 2 " , " 3 " , " \n " , " " ] . filter { $0 < x }
311
+ }
307
312
}
308
313
}
309
314
@@ -365,14 +370,6 @@ extension Mirror : Arbitrary {
365
370
}
366
371
}
367
372
368
-
369
- // MARK: - Implementation Details Follow
370
-
371
- extension Array where Element : Hashable {
372
- fileprivate var nub : [ Element ] {
373
- return [ Element] ( Set ( self ) )
374
- }
375
- }
376
373
#if os(Linux)
377
374
import Glibc
378
375
#else
0 commit comments