aboutsummaryrefslogtreecommitdiff
path: root/tests/iii/template-pack-errors
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-21 05:43:35 +0000
committer_ov4 <ov4@ov4.org>2026-10-21 05:43:35 +0000
commitdd5bbae055fd34ce2e12ef63f8a261c6b15dc83e (patch)
tree757e367daacf92c50148eb42d7bda97ba33ed3fb /tests/iii/template-pack-errors
parentc682f983b0dce3acba76d1f08719a26b9c52c5ec (diff)
feat(parser): parse TEMPLATE declarations, template ids and parameter packs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/iii/template-pack-errors')
-rw-r--r--tests/iii/template-pack-errors/case.json32
-rw-r--r--tests/iii/template-pack-errors/program.cps32
2 files changed, 64 insertions, 0 deletions
diff --git a/tests/iii/template-pack-errors/case.json b/tests/iii/template-pack-errors/case.json
new file mode 100644
index 0000000..53b5a23
--- /dev/null
+++ b/tests/iii/template-pack-errors/case.json
@@ -0,0 +1,32 @@
+{
+ "errors": [
+ {
+ "reason": "A pack parameter must be last",
+ "line": 2
+ },
+ {
+ "reason": "pack parameter must use the current template pack and cannot be ARRAY",
+ "line": 6
+ },
+ {
+ "reason": "pack parameter must use the current template pack and cannot be ARRAY",
+ "line": 10
+ },
+ {
+ "reason": "parameter pack must be expanded",
+ "line": 15
+ },
+ {
+ "reason": "Only a parameter pack may be expanded",
+ "line": 20
+ },
+ {
+ "reason": "Only the current template parameter pack may use",
+ "line": 25
+ },
+ {
+ "reason": "template parameter pack requires",
+ "line": 29
+ }
+ ]
+}
diff --git a/tests/iii/template-pack-errors/program.cps b/tests/iii/template-pack-errors/program.cps
new file mode 100644
index 0000000..51ffa46
--- /dev/null
+++ b/tests/iii/template-pack-errors/program.cps
@@ -0,0 +1,32 @@
+TEMPLATE <Rest...>
+PROCEDURE NotLast(Values : Rest..., Extra : INTEGER)
+ENDPROCEDURE
+
+TEMPLATE <Rest...>
+PROCEDURE ArrayPack(Values : ARRAY OF Rest...)
+ENDPROCEDURE
+
+TEMPLATE <T>
+PROCEDURE WrongPack(Values : T...)
+ENDPROCEDURE
+
+TEMPLATE <Rest...>
+PROCEDURE BarePack(Values : Rest...)
+ OUTPUT Values
+ENDPROCEDURE
+
+TEMPLATE <T>
+PROCEDURE ScalarExpansion(Value : T)
+ CALL Missing(Value...)
+ENDPROCEDURE
+
+TEMPLATE <T>
+PROCEDURE WrongTypeExpansion(Value : T)
+ CALL Missing<T...>(Value)
+ENDPROCEDURE
+
+TEMPLATE <Rest...>
+PROCEDURE MissingDots(Values : Rest)
+ENDPROCEDURE
+
+OUTPUT 0