Skip to content

fix: split().join() chaining produces correct string output#323

Merged
cs01 merged 1 commit intomainfrom
fix-split-chain-type
Mar 13, 2026
Merged

fix: split().join() chaining produces correct string output#323
cs01 merged 1 commit intomainfrom
fix-split-chain-type

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 13, 2026

Summary

  • "hello world".split(" ").join("-") was producing garbage numeric output instead of "hello-world"
  • Root cause: generateSplit never called setVariableType on its result temp, so downstream join() couldn't detect it was a %StringArray* and defaulted to numeric array join
  • One-line fix: add ctx.setVariableType(result, "%StringArray*") after the phi node in split.ts

Test plan

  • New fixture strings/string-split-chain.ts — chained split+join on string literals
  • All 618 tests pass
  • Self-hosting verification passes

🤖 Generated with Claude Code

@cs01 cs01 merged commit d3ebd57 into main Mar 13, 2026
12 checks passed
@cs01 cs01 deleted the fix-split-chain-type branch March 13, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant