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
protocolProtocolAvailableOn10_9InheritingFromProtocolAvailableOn10_51:ProtocolAvailableOn10_51{ // expected-error {{'ProtocolAvailableOn10_51' is only available in macOS 10.51 or newer}}
// expected-note@-1 * {{add @available attribute to enclosing global function}}
929
929
}
930
930
931
+
structGenericType<T>{ // expected-note {{add @available attribute to enclosing generic struct}}
932
+
func nonGenericWhereClause()where T :ProtocolAvailableOn10_51{} // expected-error {{'ProtocolAvailableOn10_51' is only available in macOS 10.51 or newer}}
933
+
// expected-note@-1 {{add @available attribute to enclosing instance method}}
934
+
935
+
structNestedTypewhere T :ProtocolAvailableOn10_51{} // expected-error {{'ProtocolAvailableOn10_51' is only available in macOS 10.51 or newer}}
936
+
// expected-note@-1 2{{add @available attribute to enclosing struct}}
937
+
}
938
+
931
939
// Extensions
932
940
933
941
extensionClassAvailableOn10_51{} // expected-error {{'ClassAvailableOn10_51' is only available in macOS 10.51 or newer}}
Copy file name to clipboardExpand all lines: test/Sema/implementation-only-import-in-decls.swift
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,11 @@ public struct TestGenericParams<T: BadProto> {} // expected-error {{cannot use p
21
21
22
22
publicstructTestGenericParamsWhereClause<T>where T:BadProto{} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
23
23
24
+
publicstructTestGenericParamsWithOuter<T>{
25
+
publicfunc nonGenericWhereClause()where T :BadProto{} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
26
+
publicstructInnerwhere T :BadProto{} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
27
+
}
28
+
24
29
publicenumTestCase{
25
30
case x(BadStruct) // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
26
31
case y(Int,BadStruct) // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
Copy file name to clipboardExpand all lines: test/attr/attr_usableFromInline.swift
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -155,3 +155,11 @@ public struct TestGenericSubscripts {
155
155
156
156
@usableFromInlinetypealiasTestGenericAlias<T:InternalProtocol>=T // expected-warning {{type referenced from a generic parameter of a '@usableFromInline' type alias should be '@usableFromInline' or public}}
157
157
@usableFromInlinetypealiasTestGenericAliasWhereClause<T>=T where T: InternalProtocol // expected-warning {{type referenced from a generic requirement of a '@usableFromInline' type alias should be '@usableFromInline' or public}}
158
+
159
+
@usableFromInlinestructGenericStruct<T>{
160
+
@usableFromInlinestructNestedwhere T :InternalProtocol{}
161
+
// expected-error@-1 {{type referenced from a generic requirement of a '@usableFromInline' struct must be '@usableFromInline' or public}}
162
+
163
+
@usableFromInlinefunc nonGenericWhereClause()where T :InternalProtocol{}
164
+
// expected-error@-1 {{type referenced from a generic requirement of a '@usableFromInline' instance method must be '@usableFromInline' or public}}
0 commit comments