notes
notes copied to clipboard
Crash copyCollectionToContiguousArray
let a = Set()
let b = Array(b) // crash
None of that is valid code.
let a = Set()is illegal because the element type of theSetisn't specified, and can't be inferred.let b = Array(b)is illegal becausebis used within its own definition. That's not a crash (runtime issue), that's a compile-time error, and that's a good thing.
Did you make a typo or something?
@amomchilov I think he meant to:
let b = Array(a) // crash.
It happens to me too. I ran all Unit tests, and this row crashed:
block(Array(dictionary.values), Array(dictionary.keys))
in the stack trace I saw that:
0 CoreFoundation 0x00007fff203feba4 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201a1be7 objc_exception_throw + 48
2 CoreFoundation 0x00007fff2040d811 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x00007fff204030ac ___forwarding___ + 1433
4 CoreFoundation 0x00007fff204051d8 _CF_forwarding_prep_0 + 120
5 libswiftCore.dylib 0x00007fff3072def9 $ss32_copyCollectionToContiguousArrayys0dE0Vy7ElementQzGxSlRzlF + 233
6 libswiftCore.dylib 0x00007fff30871562 $ss12_ArrayBufferVyxGSTsST017_copyToContiguousA0s0eA0Vy7ElementQzGyFTWTm + 34
It seems to be the same issue. Any idea why is it crashed?
I don't remember what this repo was about. What unit tests were you talking about?