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:
parent
9d56432e55
commit
fc6a34355d
0
vlib/v/checker/tests/sync_receiver_decl.out
Normal file
0
vlib/v/checker/tests/sync_receiver_decl.out
Normal file
4
vlib/v/checker/tests/sync_receiver_decl.vv
Normal file
4
vlib/v/checker/tests/sync_receiver_decl.vv
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
struct St {}
|
||||||
|
fn (shared b St) g() {}
|
||||||
|
|
||||||
|
println('ok')
|
@ -623,6 +623,9 @@ fn (mut p Parser) fn_receiver(mut params []ast.Param, mut rec ReceiverParsingInf
|
|||||||
if rec.is_mut {
|
if rec.is_mut {
|
||||||
p.next() // `mut`
|
p.next() // `mut`
|
||||||
}
|
}
|
||||||
|
if is_shared {
|
||||||
|
p.register_auto_import('sync')
|
||||||
|
}
|
||||||
rec_start_pos := p.tok.pos()
|
rec_start_pos := p.tok.pos()
|
||||||
rec.name = p.check_name()
|
rec.name = p.check_name()
|
||||||
if !rec.is_mut {
|
if !rec.is_mut {
|
||||||
|
Loading…
Reference in New Issue
Block a user