diff options
Diffstat (limited to 'tests/iii/operator-member-errors')
| -rw-r--r-- | tests/iii/operator-member-errors/case.json | 20 | ||||
| -rw-r--r-- | tests/iii/operator-member-errors/notes.md | 3 | ||||
| -rw-r--r-- | tests/iii/operator-member-errors/program.cps | 18 |
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 |
