diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-21 06:00:55 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-21 06:00:55 +0000 |
| commit | bfe020bfa91640e7a6f1a516dc752fa754249088 (patch) | |
| tree | fd82055133f45fdeaacddd4e62b210f4b63e0c03 /tests/iii/template-explicit-errors | |
| parent | c56877035d6600b463a9cbf0e339f7548c0b46fd (diff) | |
feat(codegen): support explicit template arguments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/iii/template-explicit-errors')
| -rw-r--r-- | tests/iii/template-explicit-errors/case.json | 10 | ||||
| -rw-r--r-- | tests/iii/template-explicit-errors/program.cps | 24 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/iii/template-explicit-errors/case.json b/tests/iii/template-explicit-errors/case.json new file mode 100644 index 0000000..657f69e --- /dev/null +++ b/tests/iii/template-explicit-errors/case.json @@ -0,0 +1,10 @@ +{ + "errors": [ + {"reason": "No matching overload for Max", "line": 19}, + {"reason": "No matching overload for Max", "line": 20}, + {"reason": "Explicit template arguments require a function template: Plain", "line": 21}, + {"reason": "Explicit template arguments are not allowed on builtin EOF", "line": 22}, + {"reason": "Explicit template arguments are not allowed on builtin MALLOC", "line": 23}, + {"reason": "Ambiguous call to Tied", "line": 24} + ] +} diff --git a/tests/iii/template-explicit-errors/program.cps b/tests/iii/template-explicit-errors/program.cps new file mode 100644 index 0000000..5236328 --- /dev/null +++ b/tests/iii/template-explicit-errors/program.cps @@ -0,0 +1,24 @@ +TEMPLATE <T> +FUNCTION Max(A : T, B : T) RETURNS T + RETURN A +ENDFUNCTION + +FUNCTION Plain(Value : INTEGER) RETURNS INTEGER + RETURN Value +ENDFUNCTION + +TEMPLATE <A> +OVERLOAD FUNCTION Tied(Value : A) RETURNS INTEGER + RETURN 1 +ENDFUNCTION +TEMPLATE <B> +OVERLOAD FUNCTION Tied(Value : B) RETURNS INTEGER + RETURN 2 +ENDFUNCTION + +OUTPUT Max<INTEGER, REAL>(1, 2) +OUTPUT Max<REAL>(1, 2.5) +OUTPUT Plain<INTEGER>(1) +OUTPUT EOF<STRING>("file.txt") +CALL MALLOC<INTEGER>(8) +OUTPUT Tied<INTEGER>(1) |
