Skip to content

Fixes for minor compiler warnings #2638

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

Merged
merged 1 commit into from
Feb 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Foundation/Decimal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ extension Decimal {
public func pow(_ x: Decimal, _ y: Int) -> Decimal {
var x = x
var result = Decimal()
NSDecimalPower(&result, &x, y, .plain)
_ = NSDecimalPower(&result, &x, y, .plain)
return result
}

Expand Down
2 changes: 1 addition & 1 deletion Foundation/NSCFCharacterSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal class _NSCFCharacterSet : NSMutableCharacterSet {
}

override func copy(with zone: NSZone? = nil) -> Any {
return CFCharacterSetCreateCopy(kCFAllocatorSystemDefault, self._cfObject)
return CFCharacterSetCreateCopy(kCFAllocatorSystemDefault, self._cfObject) as Any
}

override func mutableCopy(with zone: NSZone? = nil) -> Any {
Expand Down
2 changes: 1 addition & 1 deletion Foundation/NSCharacterSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ open class NSCharacterSet : NSObject, NSCopying, NSMutableCopying, NSSecureCodin
if type(of: self) == NSCharacterSet.self || type(of: self) == NSMutableCharacterSet.self {
return _CFCharacterSetCreateCopy(kCFAllocatorSystemDefault, self._cfObject)
} else if type(of: self) == _NSCFCharacterSet.self {
return CFCharacterSetCreateCopy(kCFAllocatorSystemDefault, self._cfObject)
return CFCharacterSetCreateCopy(kCFAllocatorSystemDefault, self._cfObject) as Any
} else {
NSRequiresConcreteImplementation()
}
Expand Down
4 changes: 2 additions & 2 deletions Foundation/NSKeyedArchiver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ open class NSKeyedArchiver : NSCoder {
success = true
}
} else {
success = CFPropertyListWrite(plist, self._stream as! CFWriteStream,
kCFPropertyListXMLFormat_v1_0, 0, nil) > 0
let stream = self._stream as! CFWriteStream
success = CFPropertyListWrite(plist, stream, kCFPropertyListXMLFormat_v1_0, 0, nil) > 0
}

return success
Expand Down
2 changes: 1 addition & 1 deletion Foundation/NSObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ open class NSObject : NSObjectProtocol, Equatable, Hashable {
// On Darwin, avoids dipping into the class hierarchy that exists above this class,
// which is ultimately rooted in the ObjC NSObject class.
guard !(self == NSObject.self) else { return nil }
return _getSuperclass(self) as! NSObject.Type
return _getSuperclass(self) as? NSObject.Type
}

public class var superclass: AnyClass? {
Expand Down
2 changes: 1 addition & 1 deletion Foundation/NumberFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ open class NumberFormatter : Formatter {

private func defaultFormatWidth() -> Int {
switch numberStyle {
case .ordinal, .ordinal, .spellOut, .currencyPlural:
case .ordinal, .spellOut, .currencyPlural:
return 0

case .none, .decimal, .currency, .percent, .scientific, .currencyISOCode, .currencyAccounting:
Expand Down
2 changes: 1 addition & 1 deletion Foundation/URLResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private func getSuggestedFilename(fromHeaderFields headerFields: [String : Strin
else { return nil }
for part in field.parameters where part.attribute == "filename" {
if let path = part.value {
return (path as? NSString)?.pathComponents.map{ $0 == "/" ? "" : $0}.joined(separator: "_")
return (path as NSString).pathComponents.map{ $0 == "/" ? "" : $0}.joined(separator: "_")
} else {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion Foundation/URLSession/FoundationNetworking-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>SwiftFoundation</string>
<key>CFBundleIdentifier</key>
<string>org.swift.Foundation</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down