Skip to content

Widen str to accept text input (identity passthrough)#655

Merged
danieljohnmorris merged 3 commits into
mainfrom
feature/str-text-identity
May 22, 2026
Merged

Widen str to accept text input (identity passthrough)#655
danieljohnmorris merged 3 commits into
mainfrom
feature/str-text-identity

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

  • str now accepts text as input and returns it unchanged (identity passthrough), making it polymorphic-identity for already-stringy values
  • Number conversion behaviour is unchanged; non-text/non-number still raises a runtime error (str requires a number or text)
  • All three execution paths updated: tree interpreter (src/interpreter/mod.rs), VM bytecode (OP_STR in src/vm/mod.rs), and JIT helper (jit_str). The VM path correctly calls clone_rc on the heap string for the passthrough case
  • Verifier (builtin_check_args) and BUILTINS signature table updated: str now accepts t_or_n
  • builtin_as_fn_ty updated to return Unknown -> t (polymorphic)

Fixes ILO-375.

Test plan

  • str_text_passthrough_cross_enginestr "hello" returns "hello" across all engines
  • str_text_passthrough_empty_cross_enginestr "" returns ""
  • str_number_cross_engine — existing number conversion still works
  • verify::builtin_str_text_passthrough — text arg no longer triggers ILO-T013
  • verify::builtin_str_wrong_type — bool still triggers ILO-T013 with updated message
  • vm_str_text_passthrough — VM OP_STR returns text unchanged
  • vm_str_non_text_non_number_type_error — VM errors on non-text/non-number
  • jit_str_text_passthrough — JIT helper returns text unchanged
  • jit_str_non_number_non_text_signals_runtime_error — JIT helper errors on nil

🤖 Generated with Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@danieljohnmorris danieljohnmorris added the mini Created by mini PC autonomous workflow label May 22, 2026
Daniel Morris and others added 2 commits May 22, 2026 10:02
str now returns its argument unchanged when passed text, making it
polymorphic-identity for already-stringy values. Number conversion
behaviour is unchanged; non-text/non-number still raises a runtime error.
Updated interpreter, VM (OP_STR), JIT helper (jit_str), and verifier
(builtin_check_args + BUILTINS signature table). All three execution
paths clone_rc correctly for the text passthrough branch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@danieljohnmorris danieljohnmorris force-pushed the feature/str-text-identity branch from 4194162 to ffa4d5e Compare May 22, 2026 09:02
@danieljohnmorris danieljohnmorris merged commit 24095b7 into main May 22, 2026
1 of 10 checks passed
@danieljohnmorris danieljohnmorris deleted the feature/str-text-identity branch May 22, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mini Created by mini PC autonomous workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant