Skip to content

Use macOS instead of OSX #4640

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
Apr 24, 2023
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
4 changes: 2 additions & 2 deletions Darwin/Foundation-swiftoverlay-Tests/TestCharacterSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class TestCharacterSet : XCTestCase {

func test_setOperationsOfEmptySet() {
// The following tests pass on these versions of the OS
if #available(OSX 10.12.3, iOS 10.3, watchOS 3.2, tvOS 10.2, *) {
if #available(macOS 10.12.3, iOS 10.3, watchOS 3.2, tvOS 10.2, *) {
let emptySet = CharacterSet()
let abcSet = CharacterSet(charactersIn: "abc")

Expand Down Expand Up @@ -304,7 +304,7 @@ class TestCharacterSet : XCTestCase {

/* Disabled now: rdar://problem/31746923
#if os(macOS)
if #available(OSX 10.12.4, iOS 10.3, watchOS 3.2, tvOS 10.2, *) {
if #available(macOS 10.12.4, iOS 10.3, watchOS 3.2, tvOS 10.2, *) {
let abcSet = CharacterSet(charactersIn: "abc")
let abcdSet = CharacterSet(charactersIn: "abcd")

Expand Down
10 changes: 5 additions & 5 deletions Darwin/Foundation-swiftoverlay-Tests/TestJSONEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class TestJSONEncoder : XCTestCase {
}

let model = Model.testValue
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
let expectedJSON = "{\"top\":{\"first\":\"Johnny Appleseed\",\"second\":\"[email protected]\"}}".data(using: .utf8)!
_testRoundTrip(of: model, expectedJSON: expectedJSON, outputFormatting: [.sortedKeys])
} else {
Expand Down Expand Up @@ -178,7 +178,7 @@ class TestJSONEncoder : XCTestCase {
let model = Model.testValue
// This following test would fail as it attempts to re-encode into already encoded container is invalid. This will always fail
expectCrashLater()
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
_testEncodeFailure(of: model)
} else {
_testEncodeFailure(of: model)
Expand All @@ -200,15 +200,15 @@ class TestJSONEncoder : XCTestCase {
}

func testEncodingOutputFormattingSortedKeys() {
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
let expectedJSON = "{\"email\":\"[email protected]\",\"name\":\"Johnny Appleseed\"}".data(using: .utf8)!
let person = Person.testValue
_testRoundTrip(of: person, expectedJSON: expectedJSON, outputFormatting: [.sortedKeys])
}
}

func testEncodingOutputFormattingPrettyPrintedSortedKeys() {
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
let expectedJSON = "{\n \"email\" : \"[email protected]\",\n \"name\" : \"Johnny Appleseed\"\n}".data(using: .utf8)!
let person = Person.testValue
_testRoundTrip(of: person, expectedJSON: expectedJSON, outputFormatting: [.prettyPrinted, .sortedKeys])
Expand Down Expand Up @@ -307,7 +307,7 @@ class TestJSONEncoder : XCTestCase {
}

func testEncodingDateISO8601() {
if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
let formatter = ISO8601DateFormatter()
formatter.formatOptions = .withInternetDateTime

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class TestPersonNameComponents : XCTestCase {
}

func test_AnyHashableContainingPersonNameComponents() {
if #available(OSX 10.11, iOS 9.0, *) {
if #available(macOS 10.11, iOS 9.0, *) {
let values: [PersonNameComponents] = [
makePersonNameComponents(givenName: "Kevin", familyName: "Frank"),
makePersonNameComponents(givenName: "John", familyName: "Appleseed"),
Expand All @@ -79,7 +79,7 @@ class TestPersonNameComponents : XCTestCase {
}

func test_AnyHashableCreatedFromNSPersonNameComponents() {
if #available(OSX 10.11, iOS 9.0, *) {
if #available(macOS 10.11, iOS 9.0, *) {
let values: [NSPersonNameComponents] = [
makeNSPersonNameComponents(givenName: "Kevin", familyName: "Frank"),
makeNSPersonNameComponents(givenName: "John", familyName: "Appleseed"),
Expand Down
4 changes: 2 additions & 2 deletions Darwin/Foundation-swiftoverlay-Tests/TestProgress.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import XCTest

class TestProgress : XCTestCase {
func testUserInfoConveniences() {
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
let p = Progress(parent:nil, userInfo: nil)

XCTAssertNil(p.userInfo[.throughputKey])
Expand Down Expand Up @@ -45,7 +45,7 @@ class TestProgress : XCTestCase {
}

func testPerformAsCurrent() {
if #available(OSX 10.11, iOS 8.0, *) {
if #available(macOS 10.11, iOS 8.0, *) {
// This test can be enabled once <rdar://problem/31867347> is in the SDK
/*
let p = Progress.discreteProgress(totalUnitCount: 10)
Expand Down
12 changes: 6 additions & 6 deletions Darwin/Foundation-swiftoverlay-Tests/TestURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class TestURL : XCTestCase {
#if os(macOS)
func testQuarantineProperties() {
// Test the quarantine stuff; it has special logic
if #available(OSX 10.11, iOS 9.0, *) {
if #available(macOS 10.11, iOS 9.0, *) {
// Create a temporary file
var file = URL(fileURLWithPath: NSTemporaryDirectory())
let name = "my_great_file" + UUID().uuidString
Expand Down Expand Up @@ -179,13 +179,13 @@ class TestURL : XCTestCase {
XCTAssertEqual("www.apple.com", components.host)


if #available(OSX 10.11, iOS 9.0, *) {
if #available(macOS 10.11, iOS 9.0, *) {
let rangeOfHost = components.rangeOfHost!
XCTAssertNotNil(rangeOfHost)
XCTAssertEqual(s[rangeOfHost], "www.apple.com")
}

if #available(OSX 10.10, iOS 8.0, *) {
if #available(macOS 10.10, iOS 8.0, *) {
let qi = components.queryItems!
XCTAssertNotNil(qi)

Expand All @@ -197,7 +197,7 @@ class TestURL : XCTestCase {
XCTAssertEqual("global|nav", first.value)
}

if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
components.percentEncodedQuery = "name1%E2%80%A2=value1%E2%80%A2&name2%E2%80%A2=value2%E2%80%A2"
var qi = components.queryItems!
XCTAssertNotNil(qi)
Expand Down Expand Up @@ -349,7 +349,7 @@ class TestURL : XCTestCase {
}

func test_AnyHashableContainingURLQueryItem() {
if #available(OSX 10.10, iOS 8.0, *) {
if #available(macOS 10.10, iOS 8.0, *) {
let values: [URLQueryItem] = [
URLQueryItem(name: "foo", value: nil),
URLQueryItem(name: "bar", value: nil),
Expand All @@ -365,7 +365,7 @@ class TestURL : XCTestCase {
}

func test_AnyHashableCreatedFromNSURLQueryItem() {
if #available(OSX 10.10, iOS 8.0, *) {
if #available(macOS 10.10, iOS 8.0, *) {
let values: [NSURLQueryItem] = [
NSURLQueryItem(name: "foo", value: nil),
NSURLQueryItem(name: "bar", value: nil),
Expand Down
2 changes: 1 addition & 1 deletion Darwin/Foundation-swiftoverlay/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal func __NSDataIsCompact(_ data: NSData) -> Bool {
@_implementationOnly import _CoreFoundationOverlayShims

internal func __NSDataIsCompact(_ data: NSData) -> Bool {
if #available(OSX 10.10, iOS 8.0, tvOS 9.0, watchOS 2.0, *) {
if #available(macOS 10.10, iOS 8.0, tvOS 9.0, watchOS 2.0, *) {
return data._isCompact()
} else {
var compact = true
Expand Down
36 changes: 18 additions & 18 deletions Darwin/Foundation-swiftoverlay/NSValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extension NSRange: _ObjectiveCBridgeable {
_getObjCTypeEncoding(NSRange.self)) == 0,
"NSValue does not contain the right type to bridge to NSRange")
result = NSRange()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<NSRange>.size)
} else {
source.getValue(&result!)
Expand All @@ -40,7 +40,7 @@ extension NSRange: _ObjectiveCBridgeable {
return false
}
result = NSRange()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<NSRange>.size)
} else {
source.getValue(&result!)
Expand All @@ -55,7 +55,7 @@ extension NSRange: _ObjectiveCBridgeable {
_getObjCTypeEncoding(NSRange.self)) == 0,
"NSValue does not contain the right type to bridge to NSRange")
var result = NSRange()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
unwrappedSource.getValue(&result, size: MemoryLayout<NSRange>.size)
} else {
unwrappedSource.getValue(&result)
Expand All @@ -77,7 +77,7 @@ extension CGRect: _ObjectiveCBridgeable {
_getObjCTypeEncoding(CGRect.self)) == 0,
"NSValue does not contain the right type to bridge to CGRect")
result = CGRect()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<CGRect>.size)
} else {
source.getValue(&result!)
Expand All @@ -92,7 +92,7 @@ extension CGRect: _ObjectiveCBridgeable {
return false
}
result = CGRect()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<CGRect>.size)
} else {
source.getValue(&result!)
Expand All @@ -107,7 +107,7 @@ extension CGRect: _ObjectiveCBridgeable {
_getObjCTypeEncoding(CGRect.self)) == 0,
"NSValue does not contain the right type to bridge to CGRect")
var result = CGRect()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
unwrappedSource.getValue(&result, size: MemoryLayout<CGRect>.size)
} else {
unwrappedSource.getValue(&result)
Expand All @@ -129,7 +129,7 @@ extension CGPoint: _ObjectiveCBridgeable {
_getObjCTypeEncoding(CGPoint.self)) == 0,
"NSValue does not contain the right type to bridge to CGPoint")
result = CGPoint()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<CGPoint>.size)
} else {
source.getValue(&result!)
Expand All @@ -144,7 +144,7 @@ extension CGPoint: _ObjectiveCBridgeable {
return false
}
result = CGPoint()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<CGPoint>.size)
} else {
source.getValue(&result!)
Expand All @@ -159,7 +159,7 @@ extension CGPoint: _ObjectiveCBridgeable {
_getObjCTypeEncoding(CGPoint.self)) == 0,
"NSValue does not contain the right type to bridge to CGPoint")
var result = CGPoint()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
unwrappedSource.getValue(&result, size: MemoryLayout<CGPoint>.size)
} else {
unwrappedSource.getValue(&result)
Expand All @@ -181,7 +181,7 @@ extension CGVector: _ObjectiveCBridgeable {
_getObjCTypeEncoding(CGVector.self)) == 0,
"NSValue does not contain the right type to bridge to CGVector")
result = CGVector()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<CGVector>.size)
} else {
source.getValue(&result!)
Expand All @@ -196,7 +196,7 @@ extension CGVector: _ObjectiveCBridgeable {
return false
}
result = CGVector()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<CGVector>.size)
} else {
source.getValue(&result!)
Expand All @@ -211,7 +211,7 @@ extension CGVector: _ObjectiveCBridgeable {
_getObjCTypeEncoding(CGVector.self)) == 0,
"NSValue does not contain the right type to bridge to CGVector")
var result = CGVector()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
unwrappedSource.getValue(&result, size: MemoryLayout<CGVector>.size)
} else {
unwrappedSource.getValue(&result)
Expand All @@ -233,7 +233,7 @@ extension CGSize: _ObjectiveCBridgeable {
_getObjCTypeEncoding(CGSize.self)) == 0,
"NSValue does not contain the right type to bridge to CGSize")
result = CGSize()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<CGSize>.size)
} else {
source.getValue(&result!)
Expand All @@ -248,7 +248,7 @@ extension CGSize: _ObjectiveCBridgeable {
return false
}
result = CGSize()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<CGSize>.size)
} else {
source.getValue(&result!)
Expand All @@ -263,7 +263,7 @@ extension CGSize: _ObjectiveCBridgeable {
_getObjCTypeEncoding(CGSize.self)) == 0,
"NSValue does not contain the right type to bridge to CGSize")
var result = CGSize()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
unwrappedSource.getValue(&result, size: MemoryLayout<CGSize>.size)
} else {
unwrappedSource.getValue(&result)
Expand All @@ -285,7 +285,7 @@ extension CGAffineTransform: _ObjectiveCBridgeable {
_getObjCTypeEncoding(CGAffineTransform.self)) == 0,
"NSValue does not contain the right type to bridge to CGAffineTransform")
result = CGAffineTransform()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<CGAffineTransform>.size)
} else {
source.getValue(&result!)
Expand All @@ -300,7 +300,7 @@ extension CGAffineTransform: _ObjectiveCBridgeable {
return false
}
result = CGAffineTransform()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
source.getValue(&result!, size: MemoryLayout<CGAffineTransform>.size)
} else {
source.getValue(&result!)
Expand All @@ -315,7 +315,7 @@ extension CGAffineTransform: _ObjectiveCBridgeable {
_getObjCTypeEncoding(CGAffineTransform.self)) == 0,
"NSValue does not contain the right type to bridge to CGAffineTransform")
var result = CGAffineTransform()
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
unwrappedSource.getValue(&result, size: MemoryLayout<CGAffineTransform>.size)
} else {
unwrappedSource.getValue(&result)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import _SwiftFoundationOverlayShims
import _SwiftCoreFoundationOverlayShims

internal func __NSDataIsCompact(_ data: NSData) -> Bool {
if #available(OSX 10.10, iOS 8.0, tvOS 9.0, watchOS 2.0, *) {
if #available(macOS 10.10, iOS 8.0, tvOS 9.0, watchOS 2.0, *) {
return data._isCompact()
} else {
var compact = true
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/FileManager+POSIX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension FileManager {
return urls
}

if #available(OSX 10.13, *) {
if #available(macOS 10.13, *) {
var statBufPtr: UnsafeMutablePointer<statfs>?
let fsCount = getmntinfo_r_np(&statBufPtr, MNT_WAIT)
guard let statBuf = statBufPtr, fsCount > 0 else {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Foundation/JSONEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ extension JSONValue {
}
bytes.append(._closebracket)
case .object(let dict):
if #available(OSX 10.13, *), options.contains(.sortedKeys) {
if #available(macOS 10.13, *), options.contains(.sortedKeys) {
let sorted = dict.sorted { $0.key < $1.key }
self.writeObject(sorted, into: &bytes)
} else {
Expand Down Expand Up @@ -1072,7 +1072,7 @@ extension JSONValue {
self.addInset(to: &bytes, depth: depth)
bytes.append(._closebracket)
case .object(let dict):
if #available(OSX 10.13, *), options.contains(.sortedKeys) {
if #available(macOS 10.13, *), options.contains(.sortedKeys) {
let sorted = dict.sorted { $0.key < $1.key }
self.writePrettyObject(sorted, into: &bytes, depth: depth)
} else {
Expand Down
4 changes: 2 additions & 2 deletions Tests/Foundation/Tests/TestJSONEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class TestJSONEncoder : XCTestCase {
_testRoundTrip(of: person, expectedJSON: expectedJSON, outputFormatting: [.prettyPrinted])

let encoder = JSONEncoder()
if #available(OSX 10.13, *) {
if #available(macOS 10.13, *) {
encoder.outputFormatting = [.prettyPrinted, .sortedKeys]
} else {
// Fallback on earlier versions
Expand Down Expand Up @@ -942,7 +942,7 @@ class TestJSONEncoder : XCTestCase {

func test_OutputFormattingValues() {
XCTAssertEqual(JSONEncoder.OutputFormatting.prettyPrinted.rawValue, 1)
if #available(OSX 10.13, *) {
if #available(macOS 10.13, *) {
XCTAssertEqual(JSONEncoder.OutputFormatting.sortedKeys.rawValue, 2)
}
XCTAssertEqual(JSONEncoder.OutputFormatting.withoutEscapingSlashes.rawValue, 8)
Expand Down
Loading