Skip to content

fix: don't crash on charlist with pure interpolation#133

Merged
mhanberg merged 1 commit into
elixir-tools:mainfrom
moxley:fix-list-string-pure-interpolation
May 16, 2026
Merged

fix: don't crash on charlist with pure interpolation#133
mhanberg merged 1 commit into
elixir-tools:mainfrom
moxley:fix-list-string-pure-interpolation

Conversation

@moxley
Copy link
Copy Markdown
Contributor

@moxley moxley commented May 15, 2026

The :list_string non-interpolation clause of parse_string/1 was missing the when is_binary(string) guard that the parallel :bin_string clause has. When the tokenizer emits a single-element token list for a charlist that contains only an interpolation (e.g. '#{x}'), the unguarded clause matches and calls String.to_charlist/1 on the interpolation-segment tuple, raising FunctionClauseError.

Charlists with surrounding text ('foo#{x}bar') were unaffected because their token list has multiple elements and falls through to the interpolation-aware clause.

Fixes #132

The :list_string non-interpolation clause of parse_string/1 was missing
the `when is_binary(string)` guard that the parallel :bin_string clause
has. When the tokenizer emits a single-element token list for a charlist
that contains only an interpolation (e.g. '#{x}'), the unguarded clause
matches and calls String.to_charlist/1 on the interpolation-segment
tuple, raising FunctionClauseError.

Charlists with surrounding text ('foo#{x}bar') were unaffected because
their token list has multiple elements and falls through to the
interpolation-aware clause.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mhanberg
Copy link
Copy Markdown
Contributor

Please remove Claude as the coauthor

@mhanberg
Copy link
Copy Markdown
Contributor

You can replace it with an Assisted-by: Opus 4.7 commit trailer if you want.

@mhanberg mhanberg merged commit 7ca4ccb into elixir-tools:main May 16, 2026
37 checks passed
@mhanberg
Copy link
Copy Markdown
Contributor

Oh never mind I was able to remove it

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.

Parser crashes on charlist with pure interpolation ('#{x}')

2 participants