You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lexer: unknown string escapes silently drop the backslash — \u{...} produces literal text #929
Cost a debugging round in the #921 workspace campaign: \u{0} in an argv-builder produced the literal four characters u{0} instead of NUL (or an error), so the exec blob was silently garbage and the child never ran.
Behavior
with -e 'print("A=[\u{41}] q=[\q] x=[\x41]")'
→ A=[u{41}] q=[q] x=[A]
Any unknown escape drops the backslash and keeps the rest as literal text. \x41 is supported; \u{...} is not; \q and every other unknown escape pass silently.
Expected
An unknown escape sequence is a compile error, not silent text. Rust errors on unknown escapes; C6 warns-by-default and gcc/clang error under -Werror; Zig errors. Silent transformation is the worst of the options — the written program and the running program disagree with no diagnostic, in exactly the kind of low-level string (argv blobs, wire formats) where a wrong byte is invisible until a subprocess mysteriously fails.
Two separable pieces:
Unknown escape → hard error (the footgun fix).
Optionally, support \u{...} as the Unicode escape alongside \x — it's the spelling both Rust and Swift readers expect; without it, the error message from (1) should suggest \x or a literal.
Spec: §string literals should enumerate the accepted escapes; the mission's "fail loudly" doctrine (No Silent Fallbacks) applies to the lexer as much as codegen.
Fixed in 8034b3d. parse_string_literal validates every escape against the set the three decoders agree on (\n \t \r \0 \\ \" \' \{ \} \xHH) and errors with the offending two characters plus the supported list (rendered from the same set). Raw strings and f-string hole expressions are untouched.
The sweep the check enables found two live instances in our own tree: tools/migrate_seams.w joined argv with "\u{1}" (four literal characters, never byte 1), and build/compiler.w spelled § as C octal \302\247, rendering as the text 30224714.19 roadmap. Both fixed in the same commit.
Also fixed while pinning \{: the f-string desugar checked {{ before the backslash escape, so f"\{{x}" was the literal text {x; \{ now wins when its backslash is unescaped (odd run), so f"\\{{x}}" still means backslash, brace, x, brace.
Activity
build: native Workspace for plain compiles — the runner stops falling…
Parser: unknown string escapes are compile errors; \{ beats {{ in f-s…
ehartford commentedon Sep 1, 2026
Fixed in 8034b3d.
parse_string_literalvalidates every escape against the set the three decoders agree on (\n \t \r \0 \\ \" \' \{ \} \xHH) and errors with the offending two characters plus the supported list (rendered from the same set). Raw strings and f-string hole expressions are untouched.The sweep the check enables found two live instances in our own tree:
tools/migrate_seams.wjoined argv with"\u{1}"(four literal characters, never byte 1), andbuild/compiler.wspelled § as C octal\302\247, rendering as the text30224714.19 roadmap. Both fixed in the same commit.Also fixed while pinning
\{: the f-string desugar checked{{before the backslash escape, sof"\{{x}"was the literal text{x;\{now wins when its backslash is unescaped (odd run), sof"\\{{x}}"still means backslash, brace, x, brace.Fixtures:
err_string_unknown_escape,err_string_unknown_escape_letter,behav_string_known_escapes. Battery green, reseeded.Parser: c"..." literals get the #929 escape validation too