fmt: fix fn return types list ending with comma (#14529)

master
yuyi 2022-05-26 09:20:22 +08:00 committed by GitHub
parent 410b57b2fa
commit 3849cdcecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,5 @@
fn ok(a int) (int, string) {
return 11, 'hello'
}
fn main() {}

View File

@ -0,0 +1,5 @@
fn ok(a int,) (int, string,) {
return 11, 'hello'
}
fn main() {}

View File

@ -198,7 +198,7 @@ pub fn (mut p Parser) parse_multi_return_type() ast.Type {
p.check(.lpar)
mut mr_types := []ast.Type{}
mut has_generic := false
for p.tok.kind != .eof {
for p.tok.kind !in [.eof, .rpar] {
mr_type := p.parse_type()
if mr_type.idx() == 0 {
break