Skip to content

Unified: Interpret all kinds of Swift string literals - #23344

Draft
asgerf wants to merge 1 commit into
mainfrom
asgerf-unified-swift-string-literals
Draft

asgerf wants to merge 1 commit into
mainfrom
asgerf-unified-swift-string-literals

Conversation

@asgerf

@asgerf asgerf commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 2aa1e2f0d7e9dfdab8c1fa021d37cefccf29297b

Dimension Assessment Rationale
Change confidence 8.5/10 ↑ Rust unit tests cover escapes, raw delimiters, malformed escapes and line endings.
↑ New corpus test and extended BasicTest QL test show correct interpreted values; all 22 QL tests pass.
↓ Relies on swift-syntax already stripping multi-line indentation and line continuations.
↓ CI not yet observed.

The interpreted string values for Swift only stripped surrounding quotes, so escape sequences, raw strings and multi-line strings got wrong values.

  • Escape sequences (\0 \\ \t \n \r \" \', \u{...}) are now decoded. Malformed escapes are kept verbatim.
  • Raw strings only treat \ followed by the matching number of # as an escape (e.g. \#n in #"..."#). For interpolated raw strings, each segment uses the enclosing literal's pound count.
  • CRLF/CR line endings are normalised to LF.
  • Interpolation-free literals that swift-syntax splits into several segments (multi-line and raw strings) are now extracted as a single string_literal with the full value, rather than a string_interpolation_expr.

Indentation removal and line continuations for multi-line strings are handled by swift-syntax's segment text.

Resolve escape sequences (including raw-string delimiters) and normalise
line endings when computing interpreted string values, and extract
interpolation-free multi-segment literals (e.g. multi-line strings) as a
single string literal.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant