aboutsummaryrefslogtreecommitdiff
path: root/tests/iii/input-invalid-targets
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 05:08:42 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 05:08:42 +0000
commita6b8afcfb61e1d321405fe8713beaec2aa6320a2 (patch)
treea621462bd6f858d1e78495e8c850a2e7321f4809 /tests/iii/input-invalid-targets
parent5c3d4d059ae70ea72b52e89940746d61c1d962db (diff)
feat(input): support array elements and member targets
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'tests/iii/input-invalid-targets')
-rw-r--r--tests/iii/input-invalid-targets/case.json32
-rw-r--r--tests/iii/input-invalid-targets/notes.md3
-rw-r--r--tests/iii/input-invalid-targets/program.cps22
3 files changed, 57 insertions, 0 deletions
diff --git a/tests/iii/input-invalid-targets/case.json b/tests/iii/input-invalid-targets/case.json
new file mode 100644
index 0000000..be4d749
--- /dev/null
+++ b/tests/iii/input-invalid-targets/case.json
@@ -0,0 +1,32 @@
+{
+ "errors": [
+ {
+ "reason": "Constant Limit is not a writable location",
+ "line": 16
+ },
+ {
+ "reason": "Cannot access private field Hidden of type Box",
+ "line": 17
+ },
+ {
+ "reason": "Whole array Scores is not an assignable location",
+ "line": 18
+ },
+ {
+ "reason": "INPUT is not supported for a value of type Student",
+ "line": 19
+ },
+ {
+ "reason": "INPUT is not supported for a value of type StudentPtr",
+ "line": 20
+ },
+ {
+ "reason": "INPUT is not supported for a value of type Season",
+ "line": 21
+ },
+ {
+ "reason": "INPUT is not supported for C pointer or void type C_STRING",
+ "line": 22
+ }
+ ]
+}
diff --git a/tests/iii/input-invalid-targets/notes.md b/tests/iii/input-invalid-targets/notes.md
new file mode 100644
index 0000000..b92b0cb
--- /dev/null
+++ b/tests/iii/input-invalid-targets/notes.md
@@ -0,0 +1,3 @@
+# Invalid INPUT targets
+
+Constants, private fields and whole arrays are not writable scalar locations. Whole records, enums, pseudocode pointers and C pointers remain unsupported INPUT value types. These diagnostics preserve the existing restrictions while accepting scalar array elements and public fields.
diff --git a/tests/iii/input-invalid-targets/program.cps b/tests/iii/input-invalid-targets/program.cps
new file mode 100644
index 0000000..6c5dc89
--- /dev/null
+++ b/tests/iii/input-invalid-targets/program.cps
@@ -0,0 +1,22 @@
+TYPE Student
+ DECLARE Score : INTEGER
+ENDTYPE
+CLASS Box
+ PRIVATE Hidden : INTEGER
+ENDCLASS
+TYPE StudentPtr = ^Student
+TYPE Season = (Spring, Summer)
+CONSTANT Limit = 3
+DECLARE Scores : ARRAY[1:2] OF INTEGER
+DECLARE Item : Box
+DECLARE Person : Student
+DECLARE P : StudentPtr
+DECLARE S : Season
+DECLARE Text : C_STRING
+INPUT Limit
+INPUT Item.Hidden
+INPUT Scores
+INPUT Person
+INPUT P
+INPUT S
+INPUT Text