checker(js): allows you to pass a numeric value to JS.Number without a cast
Describe the bug
This bug was discovered while developing PR #24653. The checker allows us to pass a numeric value to JS.Number without a prior cast, which leads to an error during JSGen.
Reproduction Steps
$ cat main.v
fn x(a JS.Number) {
println(a)
}
fn main() {
d := 1
x(d)
}
Expected Behavior
I was expecting a compiler error in this case, suggesting the use of JS.Number(d).
Current Behavior
$ v -b js run main.v
jsgen error: could not generate string method voidptr_str for type 'voidptr'
Possible Solution
No response
Additional Information/Context
No response
V version
V latest
Environment details (OS name and version, etc.)
anywhere
[!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.
Connected to Huly®: V_0.6-23034
I don't think it's a good idea to mix JavaScript primitive types with V. Why would you use JS.Number? Do you have any examples?
@gchumillas
There is no better example than the definitions of JS. interfaces that have methods with arguments of type JS.Number, for example: JS.String