Skip to content

Commit 09af72e

Browse files
committed
Tests: Consolidate opaque result type availability tests.
1 parent 34c417d commit 09af72e

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

test/Sema/availability.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,3 @@ struct DeferBody {
8686
// expected-error@-1 {{'No' is unavailable}}
8787
}
8888
}
89-
90-
struct NotP {}
91-
92-
protocol P {}
93-
94-
@available(*, unavailable)
95-
extension NotP: P {} // expected-note {{conformance of 'NotP' to 'P' has been explicitly marked unavailable here}}
96-
97-
@available(SwiftStdlib 5.1, *)
98-
func requireP() -> some P {
99-
NotP() // expected-error {{conformance of 'NotP' to 'P' is unavailable}}
100-
}

test/type/opaque_availability.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
// RUN: %target-swift-frontend -parse-stdlib -target x86_64-apple-macosx10.9 -typecheck -verify %s
2-
// RUN: %target-swift-frontend -parse-stdlib -target x86_64-apple-macosx10.15 -typecheck %s
1+
// RUN: %target-swift-frontend -parse-stdlib -target x86_64-apple-macosx10.9 -typecheck %s -verify -verify-additional-prefix only-available-
2+
// RUN: %target-swift-frontend -parse-stdlib -target x86_64-apple-macosx10.15 -typecheck %s -verify
33
// REQUIRES: OS=macosx
44

55
protocol P {}
66
struct X: P {}
77

8-
func alwaysOpaque() -> some P { return X() } // expected-error{{'some' return types are only available}} expected-note{{add @available}}
8+
func alwaysOpaque() -> some P { return X() } // expected-only-available-error{{'some' return types are only available}} expected-only-available-note{{add @available}}
99

10-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
10+
@available(SwiftStdlib 5.1, *)
1111
func sometimesOpaque() -> some P { return X() }
1212

13+
struct NotP {}
1314

15+
@available(*, unavailable)
16+
extension NotP: P {} // expected-note {{conformance of 'NotP' to 'P' has been explicitly marked unavailable here}}
17+
18+
@available(SwiftStdlib 5.1, *)
19+
func requireP() -> some P {
20+
NotP() // expected-error {{conformance of 'NotP' to 'P' is unavailable}}
21+
}

0 commit comments

Comments
 (0)