[swift-dev] swiftCore dependencies on Foundation

Joe Groff jgroff at apple.com
Tue Oct 4 14:22:09 CDT 2016


> On Oct 4, 2016, at 10:11 AM, Jordan Rose via swift-dev <swift-dev at swift.org> wrote:
> 
> In HuonW’s recent pull request <https://github.com/apple/swift/pull/4814> we hit an unusual error <https://ci.swift.org/job/swift-PR-osx/3922/>:
> 
>> 2016-10-03 12:34:08.112 swift[56714:13650955] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -length only defined for abstract class.  Define -[_TtCs19_NSContiguousString length]!'
>> *** First throw call stack:
>> (
>> 	0   CoreFoundation                      0x00007fff9cbe64f2 __exceptionPreprocess + 178
>> 	1   libobjc.A.dylib                     0x00007fff9daaa73c objc_exception_throw + 48
>> 	2   CoreFoundation                      0x00007fff9cc4d4bd +[NSException raise:format:] + 205
>> 	3   Foundation                          0x00007fff943e8dbd NSRequestConcreteImplementation + 229
>> 	4   Foundation                          0x00007fff9442588a -[NSString length] + 19
>> 	5   CoreFoundation                      0x00007fff9cc2b613 CFStringHashNSString + 51
>> 	6   libswiftCore.dylib                  0x0000000114f7ef56 _TTSfq4s___TFSSg9hashValueSi + 118
>> 	7   libswiftCore.dylib                  0x0000000114f3b96b _TTWSSs8HashablesFS_g9hashValueSi + 43
>> 	8   libswiftCore.dylib                  0x0000000114e8f0a2 _TFVs24_NativeDictionaryStorage7_bucketfxSi + 34
> 
> We’re not really sure how this could happen, though. _NSContiguousString certainly does implement -length <https://github.com/apple/swift/blob/master/stdlib/public/core/StringBridge.swift#L221>, and even though there’s an outstanding PR <https://github.com/apple/swift/pull/5071> to change it to a property that shouldn’t cause this kind of issue. (It’s not marked @objc, but it shouldn’t need to be because the superclass is <https://github.com/apple/swift/blob/master/stdlib/public/core/StringBridge.swift#L184-L191>.)
> 
> Anyone know what’s going on here?

I didn't see any obvious reason it would, but since this patch messes with IRGen it would be good to double-check that we still emit ObjC class metadata with the correct format. This seems like the kind of problem that could arise if we ended up generating the method tables incorrectly for some reason.

-Joe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20161004/9d8d627f/attachment.html>


More information about the swift-dev mailing list