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
Copy file name to clipboardExpand all lines: test/decl/nested/protocol_experimental.swift
+17-1Lines changed: 17 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -172,10 +172,26 @@ protocol OuterProtocol {
172
172
173
173
structConformsToOuterProtocol:OuterProtocol{
174
174
typealiasHen=Int
175
-
176
175
func f(){let _ =InnerProtocol.self } // expected-error {{use of protocol 'OuterProtocol.InnerProtocol' as a type must be written 'any OuterProtocol.InnerProtocol'}}
177
176
}
178
177
178
+
extensionOuterProtocol{
179
+
protocolDefinedInExtension{} // expected-error{{protocol 'DefinedInExtension' cannot be nested inside another protocol}}
180
+
}
181
+
182
+
extensionOuterProtocol{
183
+
func f(){
184
+
protocol Invalid_0{} // expected-error{{protocol 'Invalid_0' cannot be nested inside a generic context}}
185
+
186
+
structSomeType{ // expected-error{{type 'SomeType' cannot be nested in generic function 'f()'}}
187
+
protocolInvalid_1{} // expected-error{{protocol 'Invalid_1' cannot be nested inside a generic context}}
188
+
}
189
+
}
190
+
func g<T>(_:T){
191
+
protocol Invalid_2{} // expected-error{{protocol 'Invalid_2' cannot be nested inside a generic context}}
192
+
}
193
+
}
194
+
179
195
// 'InnerProtocol' does not inherit the generic parameters of
180
196
// 'OtherGenericClass', so the occurrence of 'OtherGenericClass'
181
197
// in 'InnerProtocol' is not "in context" with implicitly
0 commit comments