From dd5bbae055fd34ce2e12ef63f8a261c6b15dc83e Mon Sep 17 00:00:00 2001 From: _ov4 Date: Wed, 21 Oct 2026 05:43:35 +0000 Subject: feat(parser): parse TEMPLATE declarations, template ids and parameter packs Co-Authored-By: Claude Opus 5.5 --- tests/i/template-unused/lib.cps | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/i/template-unused/lib.cps (limited to 'tests/i/template-unused/lib.cps') diff --git a/tests/i/template-unused/lib.cps b/tests/i/template-unused/lib.cps new file mode 100644 index 0000000..3de8ac3 --- /dev/null +++ b/tests/i/template-unused/lib.cps @@ -0,0 +1,48 @@ +TEMPLATE +FUNCTION Identity(Value : T) RETURNS T + IF Value < Value THEN + RETURN (T)Value + ENDIF + RETURN Value +ENDFUNCTION + +TEMPLATE +OVERLOAD PROCEDURE Visit(First : T, Others : Rest...) + OUTPUT Identity(First) + CALL Visit(Others...) + Visit>>(Others...) +ENDPROCEDURE + +TEMPLATE +CLASS Box + PRIVATE Value : T + PUBLIC PROCEDURE NEW(V : T) + Value <- V + ENDPROCEDURE + PUBLIC FUNCTION Get() RETURNS T + RETURN Value + ENDFUNCTION + PUBLIC FUNCTION AsBox(V : Box) RETURNS Box + RETURN (Box)V + ENDFUNCTION +ENDCLASS + +TEMPLATE +CLASS Pair + Left : A + Right : B +ENDCLASS + +TEMPLATE +CLASS Bundle + PUBLIC PROCEDURE Send(Values : Rest...) + CALL Visit(Values...) + ENDPROCEDURE +ENDCLASS + +TEMPLATE +PROCEDURE NestedTypes(Value : Box>) + DECLARE Other : Box> + Other <- NEW Box>() + Value <- (Box>)Value +ENDPROCEDURE -- cgit v1.3.1-4-g156e