Skip to content

Commit 57f431d

Browse files
committed
Update more tests for associated types with availability
1 parent bcc7a5b commit 57f431d

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

test/Parse/invalid.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,5 @@ class C_50734<@NSApplicationMain T: AnyObject> {} // expected-error {{@NSApplica
148148
func f6_50734<@discardableResult T>(x: T) {} // expected-error {{'@discardableResult' attribute cannot be applied to this declaration}}
149149
enum E_50734<@indirect T> {} // expected-error {{'indirect' is a declaration modifier, not an attribute}} expected-error {{'indirect' modifier cannot be applied to this declaration}}
150150
protocol P {
151-
@available(swift, introduced: 4.2) associatedtype Assoc // expected-error {{'@available' attribute cannot be applied to this declaration}}
151+
@available(swift, introduced: 4) associatedtype Assoc
152152
}

test/api-digester/Outputs/Cake-abi.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ cake: Accessor GlobalLetChangedToVar.Modify() is a new API without @available at
6161
cake: Accessor GlobalLetChangedToVar.Set() is a new API without @available attribute
6262
cake: Accessor fixedLayoutStruct2.BecomeFixedBinaryOrder.Modify() is a new API without @available attribute
6363
cake: Accessor fixedLayoutStruct2.BecomeFixedBinaryOrder.Set() is a new API without @available attribute
64+
cake: AssociatedType RequirementChanges.addedTypeWithDefault is a new API without @available attribute
65+
cake: AssociatedType RequirementChanges.addedTypeWithoutDefault is a new API without @available attribute
6466
cake: Class C0 is a new API without @available attribute
6567
cake: Class C8 is a new API without @available attribute
6668
cake: Constructor AddingNewDesignatedInit.init(_:) is a new API without @available attribute

test/attr/attr_inlinable_available.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,8 +1467,11 @@ public protocol NoAvailableProtoWithAssoc { // expected-note 3 {{add @available
14671467
associatedtype B: BeforeInliningTargetProto
14681468
associatedtype C: AtInliningTargetProto
14691469
associatedtype D: BetweenTargetsProto // expected-error {{'BetweenTargetsProto' is only available in macOS 10.14.5 or newer; clients of 'Test' may have a lower deployment target}}
1470+
// expected-note@-1{{add @available attribute to enclosing associated type}}
14701471
associatedtype E: AtDeploymentTargetProto // expected-error {{'AtDeploymentTargetProto' is only available in macOS 10.15 or newer; clients of 'Test' may have a lower deployment target}}
1472+
// expected-note@-1{{add @available attribute to enclosing associated type}}
14711473
associatedtype F: AfterDeploymentTargetProto // expected-error {{'AfterDeploymentTargetProto' is only available in}}
1474+
// expected-note@-1{{add @available attribute to enclosing associated type}}
14721475
}
14731476

14741477
@available(macOS 10.9, *)
@@ -1477,8 +1480,11 @@ public protocol BeforeInliningTargetProtoWithAssoc {
14771480
associatedtype B: BeforeInliningTargetProto
14781481
associatedtype C: AtInliningTargetProto
14791482
associatedtype D: BetweenTargetsProto // expected-error {{'BetweenTargetsProto' is only available in macOS 10.14.5 or newer; clients of 'Test' may have a lower deployment target}}
1483+
// expected-note@-1{{add @available attribute to enclosing associated type}}
14801484
associatedtype E: AtDeploymentTargetProto // expected-error {{'AtDeploymentTargetProto' is only available in macOS 10.15 or newer; clients of 'Test' may have a lower deployment target}}
1485+
// expected-note@-1{{add @available attribute to enclosing associated type}}
14811486
associatedtype F: AfterDeploymentTargetProto // expected-error {{'AfterDeploymentTargetProto' is only available in}}
1487+
// expected-note@-1{{add @available attribute to enclosing associated type}}
14821488
}
14831489

14841490
@available(macOS 10.10, *)
@@ -1487,8 +1493,11 @@ public protocol AtInliningTargetProtoWithAssoc {
14871493
associatedtype B: BeforeInliningTargetProto
14881494
associatedtype C: AtInliningTargetProto
14891495
associatedtype D: BetweenTargetsProto // expected-error {{'BetweenTargetsProto' is only available in macOS 10.14.5 or newer; clients of 'Test' may have a lower deployment target}}
1496+
// expected-note@-1{{add @available attribute to enclosing associated type}}
14901497
associatedtype E: AtDeploymentTargetProto // expected-error {{'AtDeploymentTargetProto' is only available in macOS 10.15 or newer; clients of 'Test' may have a lower deployment target}}
1498+
// expected-note@-1{{add @available attribute to enclosing associated type}}
14911499
associatedtype F: AfterDeploymentTargetProto // expected-error {{'AfterDeploymentTargetProto' is only available in}}
1500+
// expected-note@-1{{add @available attribute to enclosing associated type}}
14921501
}
14931502

14941503
@available(macOS 10.14.5, *)
@@ -1498,7 +1507,9 @@ public protocol BetweenTargetsProtoWithAssoc {
14981507
associatedtype C: AtInliningTargetProto
14991508
associatedtype D: BetweenTargetsProto
15001509
associatedtype E: AtDeploymentTargetProto // expected-error {{'AtDeploymentTargetProto' is only available in macOS 10.15 or newer; clients of 'Test' may have a lower deployment target}}
1510+
// expected-note@-1{{add @available attribute to enclosing associated type}}
15011511
associatedtype F: AfterDeploymentTargetProto // expected-error {{'AfterDeploymentTargetProto' is only available in}}
1512+
// expected-note@-1{{add @available attribute to enclosing associated type}}
15021513
}
15031514

15041515
@available(macOS 10.15, *)
@@ -1509,6 +1520,7 @@ public protocol AtDeploymentTargetProtoWithAssoc {
15091520
associatedtype D: BetweenTargetsProto
15101521
associatedtype E: AtDeploymentTargetProto
15111522
associatedtype F: AfterDeploymentTargetProto // expected-error {{'AfterDeploymentTargetProto' is only available in}}
1523+
// expected-note@-1{{add @available attribute to enclosing associated type}}
15121524
}
15131525

15141526
@available(macOS 11, *)
@@ -1529,6 +1541,7 @@ public protocol UnavailableProtoWithAssoc {
15291541
associatedtype D: BetweenTargetsProto
15301542
associatedtype E: AtDeploymentTargetProto
15311543
associatedtype F: AfterDeploymentTargetProto // expected-error {{'AfterDeploymentTargetProto' is only available in}}
1544+
// expected-note@-1{{add @available attribute to enclosing associated type}}
15321545
associatedtype G: UnavailableProto
15331546
}
15341547

@@ -1540,6 +1553,7 @@ public protocol SPINoAvailableProtoWithAssoc { // expected-note 1 {{add @availab
15401553
associatedtype D: BetweenTargetsProto
15411554
associatedtype E: AtDeploymentTargetProto
15421555
associatedtype F: AfterDeploymentTargetProto // expected-error {{'AfterDeploymentTargetProto' is only available in}}
1556+
// expected-note@-1{{add @available attribute to enclosing associated type}}
15431557
}
15441558

15451559
// MARK: - Type aliases

0 commit comments

Comments
 (0)