aboutsummaryrefslogtreecommitdiff
path: root/tests/iii
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 06:54:32 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 06:54:32 +0000
commit74b6d06711afd3efbbc47436f1491900994313f3 (patch)
treeb9050214b147cd2b1b54fd27e75d669bf6146e48 /tests/iii
parent39661855c0816ac248be437704c76f58359cb5f0 (diff)
feat(classes): allocate objects with NEW and rebind named class variables
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/iii')
-rw-r--r--tests/iii/class-new-errors/case.json32
-rw-r--r--tests/iii/class-new-errors/program.cps26
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/iii/class-new-errors/case.json b/tests/iii/class-new-errors/case.json
new file mode 100644
index 0000000..8ce52ed
--- /dev/null
+++ b/tests/iii/class-new-errors/case.json
@@ -0,0 +1,32 @@
+{
+ "errors": [
+ {
+ "reason": "NEW target must have type Other",
+ "line": 20
+ },
+ {
+ "reason": "NEW requires a class type",
+ "line": 21
+ },
+ {
+ "reason": "NEW requires a class type",
+ "line": 22
+ },
+ {
+ "reason": "has no constructor NEW",
+ "line": 23
+ },
+ {
+ "reason": "Incorrect # arguments passed to Required.NEW",
+ "line": 24
+ },
+ {
+ "reason": "Incorrect # arguments passed to Required.NEW",
+ "line": 25
+ },
+ {
+ "reason": "NEW target must have type Hidden",
+ "line": 26
+ }
+ ]
+}
diff --git a/tests/iii/class-new-errors/program.cps b/tests/iii/class-new-errors/program.cps
new file mode 100644
index 0000000..3a9e9c2
--- /dev/null
+++ b/tests/iii/class-new-errors/program.cps
@@ -0,0 +1,26 @@
+CLASS Box
+ Value : INTEGER
+ENDCLASS
+CLASS Other
+ Value : INTEGER
+ENDCLASS
+CLASS Required
+ PROCEDURE NEW(Number : INTEGER)
+ ENDPROCEDURE
+ENDCLASS
+CLASS Hidden
+ PRIVATE PROCEDURE NEW()
+ ENDPROCEDURE
+ENDCLASS
+TYPE RecordValue
+ DECLARE Value : INTEGER
+ENDTYPE
+DECLARE B : Box
+DECLARE R : Required(1)
+B <- NEW Other
+B <- NEW INTEGER
+B <- NEW RecordValue
+B <- NEW Box(1)
+R <- NEW Required
+R <- NEW Required()
+B <- NEW Hidden