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

parser: fix missing sync auto import when only declaring shared type and not using it (#18255)

This commit is contained in:
Felipe Pena 2023-05-24 21:54:04 -03:00 committed by GitHub
parent 9d56432e55
commit fc6a34355d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1,4 @@
struct St {}
fn (shared b St) g() {}
println('ok')

View File

@ -623,6 +623,9 @@ fn (mut p Parser) fn_receiver(mut params []ast.Param, mut rec ReceiverParsingInf
if rec.is_mut {
p.next() // `mut`
}
if is_shared {
p.register_auto_import('sync')
}
rec_start_pos := p.tok.pos()
rec.name = p.check_name()
if !rec.is_mut {