You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Default generic value T{} is not recognized in if conditionΒ #22677
in if e != T{} {...} T{} is formatted wrongly by the formatter and does not complile.
Reproduction Steps
structSt[T] {
mut:
a T
}
fn (mut s St[T]) f(e T) {
// notice the wrong formatting of `if e != T{}`if e != T{
}
{
s.a= e
}
}
fnmain() {
muts:= St[int]{}
s.f(1)
}
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 condition
5 |
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.
Activity
avitkauskas commentedon Oct 28, 2024
I confirm this is fixed by #22682.
felipensp commentedon Oct 28, 2024
Thanks for testing @avitkauskas