From 0cf54b4f77ccf8376341950b02ceb7c1d1268ed7 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Fri, 30 Oct 2026 14:31:07 +0000 Subject: 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 --- tests/i/c-string-literals/expected.txt | 2 +- tests/i/c-string-literals/notes.md | 2 +- tests/i/custom-string/program.cps | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/i') diff --git a/tests/i/c-string-literals/expected.txt b/tests/i/c-string-literals/expected.txt index 2255027..ba0bd18 100644 --- a/tests/i/c-string-literals/expected.txt +++ b/tests/i/c-string-literals/expected.txt @@ -1,4 +1,4 @@ quote:" slash:\ AB 0 -1:2 +2:2 diff --git a/tests/i/c-string-literals/notes.md b/tests/i/c-string-literals/notes.md index a469ce1..a146f16 100644 --- a/tests/i/c-string-literals/notes.md +++ b/tests/i/c-string-literals/notes.md @@ -2,4 +2,4 @@ Human review: pending. Expectations follow the literal bytes and declared overloads. -The adjacent uppercase C suffix produces C_STRING. Escapes use the ordinary lexer rules. Explicit STRING casts preserve the text; an empty C string has length zero after conversion. Overload selection distinguishes STRING from C_STRING. +The adjacent uppercase C suffix produces C_STRING. Escapes use the ordinary lexer rules. Explicit STRING casts preserve the text; an empty C string has length zero after conversion. Both ordinary and suffixed literals have type C_STRING, so both calls select the exact C_STRING overload. diff --git a/tests/i/custom-string/program.cps b/tests/i/custom-string/program.cps index cf2bb24..93dcba5 100644 --- a/tests/i/custom-string/program.cps +++ b/tests/i/custom-string/program.cps @@ -1,6 +1,6 @@ CLASS STRING Text : C_STRING - PROCEDURE NEW(Value : C_STRING) + IMPLICIT PROCEDURE NEW(Value : C_STRING) Text <- Value ENDPROCEDURE FUNCTION C_STR() RETURNS C_STRING -- cgit v1.3.1-4-g156e