You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sema: Diagnose @_spi_available on declarations that cannot be unavailable.
The attribute makes the declaration unavailable from the perspective of clients
of the module's public interface and was creating a loophole that admitted
inappropriate unavailability.
Copy file name to clipboardExpand all lines: test/decl/protocol/req/unavailable.swift
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -15,8 +15,13 @@ class Foo : Proto {
15
15
// Reject protocols with 'unavailable' requirements
16
16
// if a protocol is not marked @objc.
17
17
protocolNonObjCProto{
18
-
@available(*,unavailable)func bad() // expected-error {{protocol members can only be marked unavailable in an @objc protocol}} expected-note {{protocol requires function 'bad()'}}
18
+
@available(*,unavailable) // expected-error {{protocol members can only be marked unavailable in an @objc protocol}}
19
+
func bad() // expected-note {{protocol requires function 'bad()'}}
20
+
19
21
func good()
22
+
23
+
@_spi_available(macOS, introduced:10.9) // expected-warning {{protocol members can only be marked unavailable in an @objc protocol}}
24
+
func kindaBad() // expected-note {{protocol requires function 'kindaBad()'}}
20
25
}
21
26
22
27
classBar:NonObjCProto{ // expected-error {{type 'Bar' does not conform to protocol 'NonObjCProto'}} expected-note {{add stubs for conformance}}
@@ -115,4 +120,7 @@ protocol UnavailableAssoc {
115
120
116
121
@available(swift, obsoleted:99)
117
122
associatedtypeA5
123
+
124
+
@_spi_available(macOS, introduced:11) // expected-error {{associated type cannot be marked unavailable with '@available'}}
0 commit comments