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
modulemainfnfoo[T](val T) bool {
$if T isbool|| T is $int {
returntrue
} $else {
$compile_error('only support bool or number type')
}
returnfalse
}
fnmain() {
_:=foo(123)
}
compile it:
v comp.v
Expected Behavior
compile ok
Current Behavior
$ v comp.v
comp.v:7:3: error: only support bool or number type
5 | return true
6 | } $else {
7 | $compile_error('only support bool or number type')
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 | }
9 | return false
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
$compile_error
should work with $if.Reproduction Steps
comp.v
compile it:
Expected Behavior
compile ok
Current Behavior
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.10 6ca0976.21c54ce
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.
The text was updated successfully, but these errors were encountered: