Thanks Dmitri.
If use typecasting it seems to work again. Take a look below:
// Swift 3
func quickSort(_ array: [Int]) -> [Int] {
guard array.count > 1 else {
return array
}
let (pivot, rest) = (array.first!, array.dropFirst())
let lessThan = rest.filter({ $0 < pivot })
let greaterThanOrEqual = rest.filter({ $0 >= pivot })
// If I typecast ‘[pivot]’ to ‘[Int]' it now works
return quickSort(lessThan) + ([pivot] as [Int]) +
quickSort(greaterThanOrEqual)
}
Cheers,
— A
> On Jun 27, 2016, at 1:01 PM, Dmitri Gribenko <[email protected]> wrote:
>
> On Mon, Jun 27, 2016 at 9:44 AM, Adriano Ferreira
> <[email protected]> wrote:
>>
>> Here the exact error I’m getting:
>
> I see. I think this is a compiler bug, I filed
> https://bugs.swift.org/browse/SR-1914 . Thanks!
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users