notes icon indicating copy to clipboard operation
notes copied to clipboard

Crash copyCollectionToContiguousArray

Open onmyway133 opened this issue 8 years ago • 3 comments

let a = Set()
let b = Array(b) // crash

onmyway133 avatar Jul 04 '17 09:07 onmyway133

None of that is valid code.

  • let a = Set() is illegal because the element type of the Set isn't specified, and can't be inferred.
  • let b = Array(b) is illegal because b is 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 avatar May 22 '19 00:05 amomchilov

@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?

yoni-placer avatar Feb 15 '22 23:02 yoni-placer

I don't remember what this repo was about. What unit tests were you talking about?

amomchilov avatar Feb 15 '22 23:02 amomchilov