Default generic value T{} is not recognized in if condition #22677
Labels
Bug
This tag is applied to issues which reports bugs.
Generics[T]
Bugs/feature requests, that are related to the V generics.
Status: Confirmed
This bug has been confirmed to be valid by a contributor.
Unit: Parser
Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones).
Unit: vfmt
Bugs/feature requests, that are related to the `vfmt`, the formatter for V.
Describe the bug
in
if e != T{} {...}
T{} is formatted wrongly by the formatter and does not complile.Reproduction Steps
Expected Behavior
It should be left formatted as
if e != T{}
and it should format.Current Behavior
bug2.v:7:10: error: undefined ident:
T
5 |
6 | fn (mut s St[T]) f(e T) {
7 | if e != T {
| ^
8 | }
9 | {
bug2.v:7:5: error: non-bool type
void
used as if condition5 |
6 | fn (mut s St[T]) f(e T) {
7 | if e != T {
| ~~~~~~
8 | }
9 | {
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.8 8ffcc34
Environment details (OS name and version, etc.)
macOS
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.
The text was updated successfully, but these errors were encountered: