Skip to content

Fix available attributes #4770

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
Jun 19, 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
8 changes: 4 additions & 4 deletions Darwin/Foundation-swiftoverlay-Tests/TestCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class TestCalendar : XCTestCase {

func test_properties() {
// Mainly we want to just make sure these go through to the NSCalendar implementation at this point.
if #available(iOS 8.0, OSX 10.7, *) {
if #available(iOS 8.0, macOS 10.7, *) {
var c = Calendar(identifier: .gregorian)
// Use english localization
c.locale = Locale(identifier: "en_US")
Expand Down Expand Up @@ -158,7 +158,7 @@ class TestCalendar : XCTestCase {
XCTAssertEqual(Date(timeIntervalSince1970: 1468652400.0), d1)
XCTAssertEqual(86400, ti)

if #available(iOS 10.10, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
if #available(iOS 10.10, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
let dateInterval = c.dateInterval(of: .day, for: d)
XCTAssertEqual(DateInterval(start: d1, duration: ti), dateInterval)
}
Expand Down Expand Up @@ -202,7 +202,7 @@ class TestCalendar : XCTestCase {

XCTAssertTrue(c.dateIntervalOfWeekend(containing: d, start: &d1, interval: &ti))

if #available(iOS 10.10, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
if #available(iOS 10.10, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
let thisWeekend = DateInterval(start: Date(timeIntervalSince1970: 1468652400.0), duration: 172800.0)

XCTAssertEqual(thisWeekend, DateInterval(start: d1, duration: ti))
Expand All @@ -212,7 +212,7 @@ class TestCalendar : XCTestCase {

XCTAssertTrue(c.nextWeekend(startingAfter: d, start: &d1, interval: &ti))

if #available(iOS 10.10, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
if #available(iOS 10.10, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
let nextWeekend = DateInterval(start: Date(timeIntervalSince1970: 1469257200.0), duration: 172800.0)

XCTAssertEqual(nextWeekend, DateInterval(start: d1, duration: ti))
Expand Down
14 changes: 7 additions & 7 deletions Darwin/Foundation-swiftoverlay-Tests/TestDateInterval.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TestDateInterval : XCTestCase {
}

func test_compareDateIntervals() {
if #available(iOS 10.10, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
if #available(iOS 10.10, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
let start = dateWithString("2010-05-17 14:49:47 -0700")
let duration: TimeInterval = 10000000.0
let testInterval1 = DateInterval(start: start, duration: duration)
Expand All @@ -45,7 +45,7 @@ class TestDateInterval : XCTestCase {
}

func test_isEqualToDateInterval() {
if #available(iOS 10.10, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
if #available(iOS 10.10, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
let start = dateWithString("2010-05-17 14:49:47 -0700")
let duration = 10000000.0
let testInterval1 = DateInterval(start: start, duration: duration)
Expand Down Expand Up @@ -89,7 +89,7 @@ class TestDateInterval : XCTestCase {
}

func test_checkIntersection() {
if #available(iOS 10.10, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
if #available(iOS 10.10, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
let start1 = dateWithString("2010-05-17 14:49:47 -0700")
let end1 = dateWithString("2010-08-17 14:49:47 -0700")

Expand All @@ -112,7 +112,7 @@ class TestDateInterval : XCTestCase {
}

func test_validIntersections() {
if #available(iOS 10.10, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
if #available(iOS 10.10, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
let start1 = dateWithString("2010-05-17 14:49:47 -0700")
let end1 = dateWithString("2010-08-17 14:49:47 -0700")

Expand All @@ -139,7 +139,7 @@ class TestDateInterval : XCTestCase {
}

func test_containsDate() {
if #available(iOS 10.10, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
if #available(iOS 10.10, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
let start = dateWithString("2010-05-17 14:49:47 -0700")
let duration = 10000000.0

Expand All @@ -154,7 +154,7 @@ class TestDateInterval : XCTestCase {
}

func test_AnyHashableContainingDateInterval() {
if #available(iOS 10.10, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
if #available(iOS 10.10, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
let start = dateWithString("2010-05-17 14:49:47 -0700")
let duration = 10000000.0
let values: [DateInterval] = [
Expand All @@ -172,7 +172,7 @@ class TestDateInterval : XCTestCase {
}

func test_AnyHashableCreatedFromNSDateInterval() {
if #available(iOS 10.10, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
if #available(iOS 10.10, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
let start = dateWithString("2010-05-17 14:49:47 -0700")
let duration = 10000000.0
let values: [NSDateInterval] = [
Expand Down
6 changes: 3 additions & 3 deletions Darwin/Foundation-swiftoverlay-Tests/TestMeasurement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Foundation
import XCTest

// We define our own units here so that we can have closer control over checking the behavior of just struct Measurement and not the rest of Foundation
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
class MyDimensionalUnit : Dimension {
class var unitA : MyDimensionalUnit {
return MyDimensionalUnit(symbol: "a", converter: UnitConverterLinear(coefficient: 1))
Expand All @@ -30,7 +30,7 @@ class MyDimensionalUnit : Dimension {
}
}

@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
class CustomUnit : Unit {
override init(symbol: String) {
super.init(symbol: symbol)
Expand All @@ -44,7 +44,7 @@ class CustomUnit : Unit {
public static let features = CustomUnit(symbol: "feature")
}

@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
class TestMeasurement : XCTestCase {

func testBasicConstruction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import CoreFoundation
import XCTest

class TestPersonNameComponents : XCTestCase {
@available(OSX 10.11, iOS 9.0, *)
@available(macOS 10.11, iOS 9.0, *)
func makePersonNameComponents(givenName: String, familyName: String) -> PersonNameComponents {
var result = PersonNameComponents()
result.givenName = givenName
Expand Down Expand Up @@ -70,7 +70,7 @@ class TestPersonNameComponents : XCTestCase {
}
}

@available(OSX 10.11, iOS 9.0, *)
@available(macOS 10.11, iOS 9.0, *)
func makeNSPersonNameComponents(givenName: String, familyName: String) -> NSPersonNameComponents {
let result = NSPersonNameComponents()
result.givenName = givenName
Expand Down
6 changes: 3 additions & 3 deletions Sources/Foundation/Operation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ extension OperationQueue {
public static let defaultMaxConcurrentOperationCount: Int = -1
}

@available(OSX 10.5, *)
@available(macOS 10.5, *)
open class OperationQueue : NSObject, ProgressReporting {
let __queueLock = NSLock()
let __atomicLoad = NSLock()
Expand Down Expand Up @@ -1423,15 +1423,15 @@ open class OperationQueue : NSObject, ProgressReporting {
extension OperationQueue {
// These two functions are inherently a race condition and should be avoided if possible

@available(OSX, introduced: 10.5, deprecated: 100000, message: "access to operations is inherently a race condition, it should not be used. For barrier style behaviors please use addBarrierBlock: instead")
@available(macOS, introduced: 10.5, deprecated: 100000, message: "access to operations is inherently a race condition, it should not be used. For barrier style behaviors please use addBarrierBlock: instead")
open var operations: [Operation] {
get {
return _operations(includingBarriers: false)
}
}


@available(OSX, introduced: 10.6, deprecated: 100000)
@available(macOS, introduced: 10.6, deprecated: 100000)
open var operationCount: Int {
get {
return _operationCount
Expand Down
2 changes: 1 addition & 1 deletion Tests/Foundation/Tests/TestDateInterval.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class TestDateInterval: XCTestCase {
}

func test_hashing() {
guard #available(iOS 10.10, OSX 10.12, tvOS 10.0, watchOS 3.0, *) else { return }
guard #available(iOS 10.10, macOS 10.12, tvOS 10.0, watchOS 3.0, *) else { return }

let start1a = dateWithString("2019-04-04 17:09:23 -0700")
let start1b = dateWithString("2019-04-04 17:09:23 -0700")
Expand Down
2 changes: 1 addition & 1 deletion Tests/Foundation/Tests/TestNSTextCheckingResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TestNSTextCheckingResult: XCTestCase {


func test_rangeWithName() {
guard #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) else {
guard #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) else {
return
}

Expand Down