aboutsummaryrefslogtreecommitdiff
path: root/tests/iii
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-18 06:09:01 +0000
committer_ov4 <ov4@ov4.org>2026-10-18 06:09:01 +0000
commitb17f101cfc75565f9991c856ec62f1e17b0ab104 (patch)
tree6c925f06c45dbaa557a0451cfca33f17be71ec67 /tests/iii
parent16231050058131860f710073c17d3bca7c6637eb (diff)
feat(operators): add member and unary overloads with explicit calls
Select member and global candidates together, enforce private access, and reuse argument marshalling. Materialize temporary receivers for chaining and register them for the existing object cleanup mechanism. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/iii')
-rw-r--r--tests/iii/operator-member-errors/case.json20
-rw-r--r--tests/iii/operator-member-errors/notes.md3
-rw-r--r--tests/iii/operator-member-errors/program.cps18
3 files changed, 41 insertions, 0 deletions
diff --git a/tests/iii/operator-member-errors/case.json b/tests/iii/operator-member-errors/case.json
new file mode 100644
index 0000000..1e8f8ae
--- /dev/null
+++ b/tests/iii/operator-member-errors/case.json
@@ -0,0 +1,20 @@
+{
+ "errors": [
+ {
+ "reason": "Ambiguous overload",
+ "line": 14
+ },
+ {
+ "reason": "Cannot access private method",
+ "line": 15
+ },
+ {
+ "reason": "Cannot access private method",
+ "line": 16
+ },
+ {
+ "reason": "whole array cannot be used as an operand",
+ "line": 18
+ }
+ ]
+}
diff --git a/tests/iii/operator-member-errors/notes.md b/tests/iii/operator-member-errors/notes.md
new file mode 100644
index 0000000..204ab43
--- /dev/null
+++ b/tests/iii/operator-member-errors/notes.md
@@ -0,0 +1,3 @@
+# operator-member-errors
+
+Reject equally matching member/global candidates, implicit and explicit private access, and unary operations on whole arrays.
diff --git a/tests/iii/operator-member-errors/program.cps b/tests/iii/operator-member-errors/program.cps
new file mode 100644
index 0000000..9b48135
--- /dev/null
+++ b/tests/iii/operator-member-errors/program.cps
@@ -0,0 +1,18 @@
+CLASS Box
+Value : INTEGER
+OVERLOAD FUNCTION OPERATOR+(rhs : Box) RETURNS INTEGER
+RETURN 1
+ENDFUNCTION
+PRIVATE OVERLOAD FUNCTION OPERATOR&(rhs : STRING) RETURNS STRING
+RETURN rhs
+ENDFUNCTION
+ENDCLASS
+OVERLOAD FUNCTION OPERATOR+(lhs : Box, rhs : Box) RETURNS INTEGER
+RETURN 2
+ENDFUNCTION
+DECLARE a : Box
+OUTPUT a + a
+OUTPUT a & "x"
+OUTPUT a.OPERATOR&("x")
+DECLARE items : ARRAY[1:2] OF Box
+OUTPUT NOT items