swiftlang / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.29k stars 1.13k forks source link

[SR-8919] NSString warnings #3621

Open 6d44b555-049a-4a81-86f1-5537312bcad6 opened 6 years ago

6d44b555-049a-4a81-86f1-5537312bcad6 commented 6 years ago
Previous ID SR-8919
Radar None
Original Reporter @kevints
Type Bug
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Foundation | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: fdfaaedd6d38e0c14039c828d4b5cc4b

Issue Description:

[280/334] CompileSwift: Foundation/NSString.swift
Foundation/NSString.swift:302:31: warning: '_isContiguousASCII' is deprecated
            if _storage._guts._isContiguousASCII {
                              ^
Foundation/NSString.swift:303:24: warning: 'unsafeBitCast' from 'UnsafeMutablePointer<UTF8.CodeUnit>' (aka 'UnsafeMutablePointer<UInt8>') to 'UnsafePointer<Int8>' changes pointee type and may lead to undefined behavior; use the 'withMemoryRebound' method on 'UnsafeMutablePointer<UTF8.CodeUnit>' (aka 'UnsafeMutablePointer<UInt8>') to rebind the type of memory
                return unsafeBitCast(_storage._guts.startASCII, to: UnsafePointer<Int8>.self)
                       ^
Foundation/NSString.swift:303:53: warning: 'startASCII' is deprecated
                return unsafeBitCast(_storage._guts.startASCII, to: UnsafePointer<Int8>.self)
                                                    ^
Foundation/NSString.swift:311:31: warning: '_isContiguousUTF16' is deprecated
            if _storage._guts._isContiguousUTF16 {
                              ^
Foundation/NSString.swift:312:62: warning: 'startUTF16' is deprecated
                return UnsafePointer<UniChar>(_storage._guts.startUTF16)
                                                             ^
Foundation/NSString.swift:320:36: warning: '_isContiguousASCII' is deprecated
            return !_storage._guts._isContiguousASCII
                                   ^
Foundation/NSString.swift:849:31: warning: '_isContiguousASCII' is deprecated
            if _storage._guts._isContiguousASCII {
                              ^
Foundation/NSString.swift:851:32: warning: 'startASCII' is deprecated
                _storage._guts.startASCII.withMemoryRebound(to: Int8.self,
                               ^
Foundation/NSError.swift:165:23: warning: override of 'NSObject.hashValue' is deprecated; override 'NSObject.hash' to get consistent hashing behavior
    override open var hashValue: Int {
                      ^
belkadan commented 6 years ago

@milseman?