mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Added int to float coercions to function args and returns, when specified
This commit is contained in:
@@ -10,4 +10,20 @@
|
||||
}
|
||||
|
||||
|
||||
//test function coercion
|
||||
{
|
||||
fn f(arg: float) {
|
||||
assert typeof arg == float, "argument coercion failed";
|
||||
}
|
||||
|
||||
f(42);
|
||||
|
||||
fn g(): float {
|
||||
return 42;
|
||||
}
|
||||
|
||||
assert typeof g() == float, "return coercion failed";
|
||||
}
|
||||
|
||||
|
||||
print "All good";
|
||||
|
||||
Reference in New Issue
Block a user