Added placeholders for type casts

This commit is contained in:
2025-02-27 00:18:34 +01:00
parent bbf2970c4e
commit ae6530aadb
19 changed files with 61 additions and 42 deletions

View File

@ -50,8 +50,8 @@ var errs = []struct {
{"MissingParameter3.q", errors.MissingParameter},
{"MissingType.q", errors.MissingType},
{"ReturnCountMismatch.q", &errors.ReturnCountMismatch{Count: 1, ExpectedCount: 0}},
{"TypeMismatch.q", &errors.TypeMismatch{Expected: "*any", Encountered: "int64", ParameterName: "p"}},
{"TypeMismatch2.q", &errors.TypeMismatch{Expected: "[]any", Encountered: "int64", ParameterName: "array"}},
{"TypeMismatch.q", &errors.TypeMismatch{Expected: "*any", Encountered: "int", ParameterName: "p"}},
{"TypeMismatch2.q", &errors.TypeMismatch{Expected: "[]any", Encountered: "int", ParameterName: "array"}},
{"UnknownFunction.q", &errors.UnknownFunction{Name: "unknown"}},
{"UnknownFunction2.q", &errors.UnknownFunction{Name: "f"}},
{"UnknownIdentifier.q", &errors.UnknownIdentifier{Name: "x"}},

8
tests/programs/cast.q Normal file
View File

@ -0,0 +1,8 @@
main() {
x := byte(42)
assert f(x) == 42
}
f(x byte) -> byte {
return x
}

View File

@ -67,6 +67,7 @@ var programs = []struct {
{"index-dynamic", 0},
{"struct", 0},
{"len", 0},
{"cast", 0},
}
func TestPrograms(t *testing.T) {