v
v copied to clipboard
`v fmt` parsing of comments in multi-line expressions incorrectly errors
Describe the bug
If an expression spans more than one line and contains an in-line comment, v fmt and v vet report a syntax error.
Expected Behavior
The syntax should not cause an error.
Current Behavior
The syntax is incorrectly flagged as invalid.
Reproduction Steps
Run v fmt on the following:
fn main() {
a := 4 // comment
+ 6
}
Result:
error: invalid expression: unexpected token `+`
1 | fn main() {
2 | a := 4 // comment
3 | + 6
| ^
4 | }
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.3.3 2597efa
Environment details (OS name and version, etc.)
MacOS