aboutsummaryrefslogtreecommitdiff
path: root/tests/iii/operator-global-errors/program.cps
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-18 06:05:53 +0000
committer_ov4 <ov4@ov4.org>2026-10-18 06:05:53 +0000
commit16231050058131860f710073c17d3bca7c6637eb (patch)
tree1da2ca606f1d513822ccd04b3053d5eee69ac19d /tests/iii/operator-global-errors/program.cps
parent1b0b287629e6e3b6d8eb6182db72b28fd0510574 (diff)
feat(operators): support global binary operator overloads
Resolve exact operand types and preserve declared operator return types. Reject implicit STRING to BOOLEAN conversion at typed expression boundaries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/iii/operator-global-errors/program.cps')
-rw-r--r--tests/iii/operator-global-errors/program.cps22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/iii/operator-global-errors/program.cps b/tests/iii/operator-global-errors/program.cps
new file mode 100644
index 0000000..23bfae1
--- /dev/null
+++ b/tests/iii/operator-global-errors/program.cps
@@ -0,0 +1,22 @@
+TYPE Box
+DECLARE Value : INTEGER
+ENDTYPE
+OVERLOAD FUNCTION OPERATOR+(a : Box, b : REAL) RETURNS INTEGER
+RETURN 1
+ENDFUNCTION
+OVERLOAD FUNCTION OPERATOR<(a : Box, b : Box) RETURNS STRING
+RETURN "text"
+ENDFUNCTION
+DECLARE a : Box
+DECLARE flag : BOOLEAN
+flag <- a < a
+OUTPUT a + 1
+OVERLOAD FUNCTION OPERATOR&(a : INTEGER, b : STRING) RETURNS STRING
+RETURN b
+ENDFUNCTION
+OVERLOAD FUNCTION OPERATOR*(a : Box) RETURNS INTEGER
+RETURN 1
+ENDFUNCTION
+OVERLOAD FUNCTION OPERATOR+(a : Box, b : REAL) RETURNS REAL
+RETURN 2.0
+ENDFUNCTION