Describe the bug
When use mut keyword in a struct define, it will cause vls report error.
Reproduction Steps
sample_text.v
module main
struct MyS {
mut :
b int
a string
}
Open this file with VSCode, which enable vls.
Expected Behavior
No error report in VSCode.
Current Behavior
note that there is a syntax error report , that "expected } to finish a struct definition"
Possible Solution
This is really a v parser limit that we can't use keywords in a struct definition.
p.check (.lcbr)
// if p.is_vls && p.tok.kind == .key_struct { // p.tok.is_key() {
if p.is_vls && p.tok.is_key () {
// End parsing after `struct Foo {` in vls mode to avoid lots of junk errors
// If next token after { is a key, the struct wasn't finished
p.error ('expected `}` to finish a struct definition' )
p.should_abort = true
return ast.StructDecl{
name: name
}
}
I suggest remove this limit.
Additional Information/Context
No response
V version
V 0.4.12 d9e962f
Environment details (OS name and version, etc.)
V full version
V 0.4.12 d9e962f
OS
linux, Ubuntu 24.04.3 LTS
Processor
8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
Memory
11.56GB/15.51GB
V executable
/media/HD/github/kbkpbot/v/v
V last modified time
2025-10-21 01:01:26
V home dir
OK, value: /media/HD/github/kbkpbot/v
VMODULES
OK, value: /home/mars/.vmodules
VTMP
OK, value: /tmp/v_1000
Current working dir
OK, value: /home/mars/v/bug/vls
Git version
git version 2.43.0
V git status
weekly.2025.42-35-gd9e962f1
.git/config present
true
cc version
cc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
gcc version
gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
clang version
Ubuntu clang version 18.1.3 (1ubuntu1)
tcc version
tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
tcc git status
thirdparty-linux-amd64 696c1d84
emcc version
N/A
glibc version
ldd (Ubuntu GLIBC 2.39-0ubuntu8.6) 2.39
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
Describe the bug
When use
mutkeyword in a struct define, it will causevlsreport error.Reproduction Steps
sample_text.v
Open this file with VSCode, which enable
vls.Expected Behavior
No error report in VSCode.
Current Behavior
note that there is a syntax error report , that "expected
}to finish a struct definition"Possible Solution
This is really a
vparser limit that we can't use keywords in a struct definition.v/vlib/v/parser/struct.v
Lines 133 to 143 in d9e962f
I suggest remove this limit.
Additional Information/Context
No response
V version
V 0.4.12 d9e962f
Environment details (OS name and version, etc.)
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.