-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSArray can be constructed with non-NSObjects, leading to segfaults #25
Comments
NSArray only supports NSObjects, so you can't use NSUInteger (which is a plain UInt) but you should use NSNumber: julia> a = NSNumber(42)
+ [NSNumber numberWithInteger: 42]
(id<NSNumber>)0x8aaa94e3f4001b01
- [(id<NSObject>)0x8aaa94e3f4001b01 debugDescription]
(id<NSString>)0x8aaa94e3f419140c
- [(id<NSString>)0x8aaa94e3f419140c UTF8String]
(Int8*)0x0000600001d21f48
42
julia> NSArray([a, a])
+ [NSArray arrayWithObjects:count: (id*)0x000000010beeefc0 0x0000000000000002]
(id<NSArray>)0x0000600001d10f60
- [(id<NSObject>)0x0000600001d10f60 debugDescription]
(id<NSString>)0x0000600001306ee0
- [(id<NSString>)0x0000600001306ee0 UTF8String]
(Int8*)0x0000600003624110
<__NSArrayI 0x600001d10f60>(
42,
42
) Our NSArray wrapper could be more careful about this, but more work is needed for parametric containers in general. |
My MWE was too simplified for what I was actually trying to fix. I've edited my MWE to better represent the issue. Seems like it crashes for NSObjects that have |
This works however:
Is this something that should be fixed? |
Hmm, that does make me realize that the current conversion of I'll see if I can do a quick fix, but otherwise this would probably better wait for a redesign of parametric types. |
Doesn't segfault when creating an array of strings as shown in the example (or dict for that matter), but for other objects it crashes.
MWE:
The text was updated successfully, but these errors were encountered: