diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-30 14:31:07 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-30 14:31:07 +0000 |
| commit | 0cf54b4f77ccf8376341950b02ceb7c1d1268ed7 (patch) | |
| tree | eebbba01063451c28f0a2e1cc048215f50beb98f /tests/iii | |
| parent | 4cb0d9b196008bc55dbfcdac1f9211dbbc879895 (diff) | |
refactor(strings): construct string values implicitly from raw literals
Keep double-quoted literals and text constants as C_STRING values. Use
marked STRING constructors for text and CHAR conversion, preserving
string operations and I/O through the existing class machinery.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/iii')
| -rw-r--r-- | tests/iii/class-new-errors/case.json | 2 | ||||
| -rw-r--r-- | tests/iii/implicit-string-opt-in/case.json | 15 | ||||
| -rw-r--r-- | tests/iii/implicit-string-opt-in/program.cps | 14 | ||||
| -rw-r--r-- | tests/iii/overload-errors/case.json | 2 | ||||
| -rw-r--r-- | tests/iii/string-type-mismatch/case.json | 2 |
5 files changed, 32 insertions, 3 deletions
diff --git a/tests/iii/class-new-errors/case.json b/tests/iii/class-new-errors/case.json index 5323679..982b80c 100644 --- a/tests/iii/class-new-errors/case.json +++ b/tests/iii/class-new-errors/case.json @@ -37,7 +37,7 @@ "line": 30 }, { - "reason": "Cannot use a value of type STRING where INTEGER is expected", + "reason": "Cannot implicitly convert C_STRING to INTEGER", "line": 31 } ] diff --git a/tests/iii/implicit-string-opt-in/case.json b/tests/iii/implicit-string-opt-in/case.json new file mode 100644 index 0000000..8fae19d --- /dev/null +++ b/tests/iii/implicit-string-opt-in/case.json @@ -0,0 +1,15 @@ +{ + "compiler_args": [ + "-no-std" + ], + "errors": [ + { + "line": 13, + "reason": "Cannot implicitly convert C_STRING to STRING" + }, + { + "line": 14, + "reason": "STRING requires an IMPLICIT constructor NEW" + } + ] +} diff --git a/tests/iii/implicit-string-opt-in/program.cps b/tests/iii/implicit-string-opt-in/program.cps new file mode 100644 index 0000000..b5afccc --- /dev/null +++ b/tests/iii/implicit-string-opt-in/program.cps @@ -0,0 +1,14 @@ +CLASS STRING + Text : C_STRING + PROCEDURE NEW(Value : C_STRING) + Text <- Value + ENDPROCEDURE + FUNCTION C_STR() RETURNS C_STRING + RETURN Text + ENDFUNCTION +ENDCLASS +DECLARE Explicit : STRING("explicit") +OUTPUT Explicit +DECLARE Text : STRING +Text <- "requires opt-in" +OUTPUT "requires opt-in" diff --git a/tests/iii/overload-errors/case.json b/tests/iii/overload-errors/case.json index 6e2156e..4608bf6 100644 --- a/tests/iii/overload-errors/case.json +++ b/tests/iii/overload-errors/case.json @@ -21,7 +21,7 @@ "line": 25 }, { - "reason": "No matching overload for Exact\\(STRING\\)", + "reason": "No matching overload for Exact\\(C_STRING\\)", "line": 28 }, { diff --git a/tests/iii/string-type-mismatch/case.json b/tests/iii/string-type-mismatch/case.json index 3471178..3a8ed29 100644 --- a/tests/iii/string-type-mismatch/case.json +++ b/tests/iii/string-type-mismatch/case.json @@ -1,7 +1,7 @@ { "errors": [ { - "reason": "Operator = cannot be applied to STRING and INTEGER", + "reason": "C and pseudocode operands require an explicit cast", "line": 2 } ] |
