diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-21 06:04:52 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-21 06:04:52 +0000 |
| commit | 25ae363250e479701ed532c55c255e043c8240da (patch) | |
| tree | 296977f6d6b1ba8ebfb5029fa0c7ea4235cbc9a5 /tests/iii/template-variadic-errors | |
| parent | bfe020bfa91640e7a6f1a516dc752fa754249088 (diff) | |
feat(codegen): add variadic function templates
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/iii/template-variadic-errors')
| -rw-r--r-- | tests/iii/template-variadic-errors/case.json | 11 | ||||
| -rw-r--r-- | tests/iii/template-variadic-errors/program.cps | 39 |
2 files changed, 50 insertions, 0 deletions
diff --git a/tests/iii/template-variadic-errors/case.json b/tests/iii/template-variadic-errors/case.json new file mode 100644 index 0000000..ac4093a --- /dev/null +++ b/tests/iii/template-variadic-errors/case.json @@ -0,0 +1,11 @@ +{ + "errors": [ + {"reason": "No matching overload for MissingBase", "line": 3}, + {"reason": "A parameter pack expansion is only allowed in an argument list", "line": 8}, + {"reason": "A parameter pack expansion is only allowed in an argument list", "line": 14}, + {"reason": "A parameter pack expansion is only allowed in an argument list", "line": 19}, + {"reason": "No matching overload for Exact", "line": 37}, + {"reason": "No matching overload for Exact", "line": 38}, + {"reason": "Ambiguous call to Tied", "line": 39} + ] +} diff --git a/tests/iii/template-variadic-errors/program.cps b/tests/iii/template-variadic-errors/program.cps new file mode 100644 index 0000000..df2ebc1 --- /dev/null +++ b/tests/iii/template-variadic-errors/program.cps @@ -0,0 +1,39 @@ +TEMPLATE <T, Rest...> +PROCEDURE MissingBase(First : T, Others : Rest...) + CALL MissingBase(Others...) +ENDPROCEDURE + +TEMPLATE <Types...> +PROCEDURE BadOutput(Values : Types...) + OUTPUT Values... +ENDPROCEDURE + +TEMPLATE <Types...> +PROCEDURE BadIndex(Values : Types...) + DECLARE Items : ARRAY[1:2] OF INTEGER + OUTPUT Items[Values...] +ENDPROCEDURE + +TEMPLATE <Types...> +PROCEDURE BadOperand(Values : Types...) + OUTPUT 1 + Values... +ENDPROCEDURE + +TEMPLATE <T, Rest...> +PROCEDURE Exact(First : T, Others : Rest...) +ENDPROCEDURE + +TEMPLATE <A...> +OVERLOAD PROCEDURE Tied(Values : A...) +ENDPROCEDURE +TEMPLATE <B...> +OVERLOAD PROCEDURE Tied(Values : B...) +ENDPROCEDURE + +CALL MissingBase(1) +CALL BadOutput(1) +CALL BadIndex(1) +CALL BadOperand(1) +CALL Exact<INTEGER, REAL>(1, 2) +CALL Exact<INTEGER, REAL, CHAR>(1, 2.5) +CALL Tied(1) |
