File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -968,7 +968,7 @@ extension Parser {
968968 }
969969
970970 // Parse the signature.
971- let signature = self . parseFunctionSignature ( allowOutput : false )
971+ let signature = self . parseFunctionSignature ( )
972972
973973 let whereClause : RawGenericWhereClauseSyntax ?
974974 if self . at ( . keyword( . where) ) {
@@ -1131,7 +1131,7 @@ extension Parser {
11311131 )
11321132 }
11331133
1134- mutating func parseFunctionSignature( allowOutput : Bool = true ) -> RawFunctionSignatureSyntax {
1134+ mutating func parseFunctionSignature( ) -> RawFunctionSignatureSyntax {
11351135 let parameterClause = self . parseParameterClause ( RawFunctionParameterClauseSyntax . self) { parser in
11361136 parser. parseFunctionParameter ( )
11371137 }
@@ -1148,19 +1148,10 @@ extension Parser {
11481148 returnClause = nil
11491149 }
11501150
1151- var unexpectedAfterReturnClause : RawUnexpectedNodesSyntax ?
1152- if !allowOutput,
1153- let unexpectedOutput = returnClause
1154- {
1155- returnClause = nil
1156- unexpectedAfterReturnClause = RawUnexpectedNodesSyntax ( [ unexpectedOutput] , arena: self . arena)
1157- }
1158-
11591151 return RawFunctionSignatureSyntax (
11601152 parameterClause: parameterClause,
11611153 effectSpecifiers: effectSpecifiers,
11621154 returnClause: returnClause,
1163- unexpectedAfterReturnClause,
11641155 arena: self . arena
11651156 )
11661157 }
Original file line number Diff line number Diff line change @@ -3156,4 +3156,14 @@ final class DeclarationTests: ParserTestCase {
31563156 XCTAssertEqual ( decl. description, input, line: line)
31573157 }
31583158 }
3159+
3160+ func testInitializerWithReturnType( ) {
3161+ assertParse (
3162+ " init(_ ptr: UnsafeRawBufferPointer, _ a: borrowing Array<Int>) -> _borrow(a) Self " ,
3163+ experimentalFeatures: . nonescapableTypes
3164+ )
3165+
3166+ // Not actually valid, needs to be diagnosed during type checking
3167+ assertParse ( " public init() -> Int " )
3168+ }
31593169}
You can’t perform that action at this time.
0 commit comments