From bfe020bfa91640e7a6f1a516dc752fa754249088 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Wed, 21 Oct 2026 06:00:55 +0000 Subject: feat(codegen): support explicit template arguments Co-Authored-By: Claude Opus 5.5 --- tests/i/template-explicit-args/program.cps | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/i/template-explicit-args/program.cps (limited to 'tests/i/template-explicit-args/program.cps') diff --git a/tests/i/template-explicit-args/program.cps b/tests/i/template-explicit-args/program.cps new file mode 100644 index 0000000..123bda6 --- /dev/null +++ b/tests/i/template-explicit-args/program.cps @@ -0,0 +1,47 @@ +TEMPLATE +FUNCTION Max(A : T, B : T) RETURNS T + IF A > B THEN + RETURN A + ENDIF + RETURN B +ENDFUNCTION + +TEMPLATE +FUNCTION Second(First : A, Last : B) RETURNS B + RETURN Last +ENDFUNCTION + +TEMPLATE +FUNCTION Zero() RETURNS T + RETURN (T)0 +ENDFUNCTION + +TEMPLATE +PROCEDURE Print(Value : T) + OUTPUT Value +ENDPROCEDURE + +TEMPLATE +FUNCTION Echo(Value : T) RETURNS T + RETURN Value +ENDFUNCTION + +TEMPLATE +OVERLOAD FUNCTION Pick(Value : T) RETURNS INTEGER + RETURN 100 +ENDFUNCTION +OVERLOAD FUNCTION Pick(Value : INTEGER) RETURNS INTEGER + RETURN 200 +ENDFUNCTION + +OUTPUT Max(1.5, 2.0) +OUTPUT Max(Max(1, 2), 3) +OUTPUT Second(7, "tail") +OUTPUT Zero() +CALL Print(2.5) +Print(9) +OUTPUT Pick(7) +OUTPUT Pick(7) +OUTPUT (STRING)Echo("chain").C_STR() +CALL Echo("discarded") +Echo("also discarded") -- cgit v1.3.1-4-g156e