File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -40,3 +40,24 @@ struct ConformsToP2 {
4040}
4141extension ConformsToP2 : P { } // expected-error{{type 'ConformsToP2' does not conform to protocol 'P'}}
4242// expected-error@-1 {{unavailable instance method 'foo(bar:)' was used to satisfy a requirement of protocol 'P'}}
43+
44+
45+ // Include message string from @available attribute if provided
46+ protocol Unavail {
47+ associatedtype T
48+ func req( ) // expected-note {{requirement 'req()' declared here}}
49+ }
50+ extension Unavail {
51+ func req( ) { }
52+ }
53+ extension Unavail where T == Self {
54+ @available ( * , unavailable, message: " write it yourself " ) func req( ) { } // expected-note {{'req()' declared here}}
55+ }
56+
57+ struct NonSelfT : Unavail {
58+ typealias T = Int
59+ }
60+ struct SelfT : Unavail { // expected-error {{type 'SelfT' does not conform to protocol 'Unavail'}}
61+ // expected-error@-1 {{unavailable instance method 'req()' was used to satisfy a requirement of protocol 'Unavail': write it yourself}}
62+ typealias T = SelfT
63+ }
You can’t perform that action at this time.
0 commit comments