diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-17 10:32:30 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-17 10:32:30 +0000 |
| commit | 377a1fd2eadd2a70cd27f13e2fee6e96c8706a51 (patch) | |
| tree | c05665f26b3434359cf4ae7720e8f9111a322522 /tests/iii/overload-errors | |
| parent | f5246db6d045ffb86d6717e1b1c37f03bcb2b75b (diff) | |
feat(codegen): overload global functions and procedures
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/iii/overload-errors')
| -rw-r--r-- | tests/iii/overload-errors/case.json | 36 | ||||
| -rw-r--r-- | tests/iii/overload-errors/program.cps | 29 |
2 files changed, 65 insertions, 0 deletions
diff --git a/tests/iii/overload-errors/case.json b/tests/iii/overload-errors/case.json new file mode 100644 index 0000000..b31c666 --- /dev/null +++ b/tests/iii/overload-errors/case.json @@ -0,0 +1,36 @@ +{ + "errors": [ + { + "reason": "every overload must be declared OVERLOAD", + "line": 4 + }, + { + "reason": "Function Ret cannot be redefined", + "line": 10 + }, + { + "reason": "Function Mode cannot be redefined", + "line": 15 + }, + { + "reason": "No matching overload for Exact\\(INTEGER\\)", + "line": 20 + }, + { + "reason": "Function Bounds cannot be redefined", + "line": 23 + }, + { + "reason": "built-in function and cannot be redefined", + "line": 25 + }, + { + "reason": "No matching overload for Exact\\(STRING\\)", + "line": 28 + }, + { + "reason": "No matching overload for Exact\\(\\)", + "line": 29 + } + ] +} diff --git a/tests/iii/overload-errors/program.cps b/tests/iii/overload-errors/program.cps new file mode 100644 index 0000000..13d4692 --- /dev/null +++ b/tests/iii/overload-errors/program.cps @@ -0,0 +1,29 @@ +OVERLOAD FUNCTION Mixed(x : INTEGER) RETURNS INTEGER +RETURN x +ENDFUNCTION +FUNCTION Mixed(x : REAL) RETURNS REAL +RETURN x +ENDFUNCTION +OVERLOAD FUNCTION Ret(x : INTEGER) RETURNS INTEGER +RETURN x +ENDFUNCTION +OVERLOAD FUNCTION Ret(x : INTEGER) RETURNS REAL +RETURN x +ENDFUNCTION +OVERLOAD PROCEDURE Mode(BYREF x : INTEGER) +ENDPROCEDURE +OVERLOAD PROCEDURE Mode(BYVAL x : INTEGER) +ENDPROCEDURE +OVERLOAD FUNCTION Exact(x : REAL) RETURNS REAL +RETURN x +ENDFUNCTION +OUTPUT Exact(1) +OVERLOAD PROCEDURE Bounds(a : ARRAY[1:2] OF INTEGER) +ENDPROCEDURE +OVERLOAD PROCEDURE Bounds(a : ARRAY[3:4] OF INTEGER) +ENDPROCEDURE +OVERLOAD FUNCTION LENGTH(x : INTEGER) RETURNS INTEGER +RETURN x +ENDFUNCTION +OUTPUT Exact("text") +OUTPUT Exact() |
