1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: fix error when using imported types in short fn signature (#7795)

This commit is contained in:
zakuro 2021-01-02 22:09:54 +09:00 committed by GitHub
parent e943d03298
commit 6bd35505a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -493,7 +493,8 @@ fn (mut p Parser) fn_args() ([]table.Param, bool, bool) {
p.tok.lit
}
types_only := p.tok.kind in [.amp, .ellipsis, .key_fn] ||
(p.peek_tok.kind == .comma && p.table.known_type(argname)) || p.peek_tok.kind == .rpar
(p.peek_tok.kind == .comma && p.table.known_type(argname)) || p.peek_tok.kind == .dot ||
p.peek_tok.kind == .rpar
// TODO copy pasta, merge 2 branches
if types_only {
// p.warn('types only')

View File

@ -1,3 +1,4 @@
import time
// 1 line comment // 1 line comment
/*
multi line comment (1)
@ -40,6 +41,8 @@ type F5 = fn (int, int) int
type F6 = fn (int, int)
type F7 = fn (time.Time, int)
fn C.atoi(byteptr) int
fn foo() {