From a6b8afcfb61e1d321405fe8713beaec2aa6320a2 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 05:08:42 +0000 Subject: feat(input): support array elements and member targets Co-Authored-By: Claude Fable 5.1 --- tests/iii/input-invalid-targets/case.json | 32 +++++++++++++++++++++++++++++ tests/iii/input-invalid-targets/notes.md | 3 +++ tests/iii/input-invalid-targets/program.cps | 22 ++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 tests/iii/input-invalid-targets/case.json create mode 100644 tests/iii/input-invalid-targets/notes.md create mode 100644 tests/iii/input-invalid-targets/program.cps (limited to 'tests/iii') 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 -- cgit v1.3.1-4-g156e