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/protocol/conforms/fixit_stub.swift
+20-2Lines changed: 20 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
protocolProtocol1{
4
4
func foo(arg1:Int, arg2:String)->String // expected-note{{protocol requires function 'foo(arg1:arg2:)' with type '(Int, String) -> String'; do you want to add a stub?}} {{27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n}}
5
5
func bar()throws->String // expected-note{{protocol requires function 'bar()' with type '() throws -> String'; do you want to add a stub?}} {{27-27=\n func bar() throws -> String {\n <#code#>\n \}\n}}
6
-
init(arg:Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; do you want to add a stub?}} {{27-27=\n init(arg: Int) {\n <#code#>\n \}\n}}
6
+
init(arg:Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; do you want to add a stub?}} {{27-27=\n required init(arg: Int) {\n <#code#>\n \}\n}}
7
7
varbaz:Int{get} // expected-note{{protocol requires property 'baz' with type 'Int'; do you want to add a stub?}} {{27-27=\n var baz: Int\n}}
8
8
varbaz2:Int{getset} // expected-note{{protocol requires property 'baz2' with type 'Int'; do you want to add a stub?}} {{27-27=\n var baz2: Int\n}}
9
9
subscript(arg:Int)->String{get} //expected-note{{rotocol requires subscript with type '(Int) -> String'; do you want to add a stub?}} {{27-27=\n subscript(arg: Int) -> String {\n <#code#>\n \}\n}}
@@ -18,7 +18,7 @@ class Adopter: Protocol1 { // expected-error{{type 'Adopter' does not conform to
18
18
protocolProtocol2{
19
19
func foo(arg1:Int, arg2:String)->String // expected-note{{protocol requires function 'foo(arg1:arg2:)' with type '(Int, String) -> String'; do you want to add a stub?}} {{32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n}}
20
20
func bar()throws->String // expected-note{{protocol requires function 'bar()' with type '() throws -> String'; do you want to add a stub?}} {{32-32=\n func bar() throws -> String {\n <#code#>\n \}\n}}
21
-
init(arg:Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; do you want to add a stub?}} {{32-32=\n init(arg: Int) {\n <#code#>\n \}\n}}
21
+
init(arg:Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'}} {{none}}
22
22
varbaz:Int{get} // expected-note{{protocol requires property 'baz' with type 'Int'; do you want to add a stub?}} {{32-32=\n var baz: Int {\n <#code#>\n \}\n}}
23
23
varbaz2:Int{getset} // expected-note{{protocol requires property 'baz2' with type 'Int'; do you want to add a stub?}} {{32-32=\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
24
24
subscript(arg:Int)->String{get} //expected-note{{rotocol requires subscript with type '(Int) -> String'; do you want to add a stub?}} {{32-32=\n subscript(arg: Int) -> String {\n <#code#>\n \}\n}}
@@ -126,3 +126,21 @@ public class Adopter11: ProtocolWithPrivateAccess3, ProtocolWithPrivateAccess4 {
126
126
// expected-error@-1{{type 'Adopter11' does not conform to protocol 'ProtocolWithPrivateAccess3'}}
127
127
// expected-error@-2{{type 'Adopter11' does not conform to protocol 'ProtocolWithPrivateAccess4'}}
128
128
}
129
+
130
+
protocolProtocolRequiresInit1{
131
+
init(arg:Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; do you want to add a stub?}} {{48-48=\n init(arg: Int) {\n <#code#>\n \}\n}}
132
+
}
133
+
finalclassAdopter12:ProtocolRequiresInit1{} //expected-error {{type 'Adopter12' does not conform to protocol 'ProtocolRequiresInit1'}} // expected-note{{candidate}}
134
+
135
+
protocolProtocolRequiresInit2{
136
+
init(arg:Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; do you want to add a stub?}} {{46-46=\n convenience init(arg: Int) {\n <#code#>\n \}\n}}
extensionAdopter13:ProtocolRequiresInit2{} //expected-error {{type 'Adopter13' does not conform to protocol 'ProtocolRequiresInit2'}}
140
+
141
+
protocolProtocolRequiresInit3{
142
+
init(arg:Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; do you want to add a stub?}} {{46-46=\n init(arg: Int) {\n <#code#>\n \}\n}}
143
+
}
144
+
145
+
structAdopter14{} // expected-note{{candidate}}
146
+
extensionAdopter14:ProtocolRequiresInit3{} //expected-error {{type 'Adopter14' does not conform to protocol 'ProtocolRequiresInit3'}}
0 commit comments