feat: add String#* (string repetition) for TryRuby L80 (#524)#532
Merged
Conversation
Map "Jimmy" * 5 to stringMethod block with METHOD=*. Generator emits infix notation (receiver * arg) instead of dot notation. finishTargets regex handles * operator inlining. Handle numeric arguments with _addNumberInput instead of _addTextInput to avoid type mismatch. Refs #524 (Phase 1 #2) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
🚀 Preview deployed: https://smalruby.jp/smalruby3-editor/feat/tryruby-string-multiply/ |
Register * method only for 'string' receiver type (not 'block' or 'variable') to avoid conflicts with numeric multiplication in expressions like (1.0 / 3435.0) * Math.log(20.0). Fixes round-trip and method-return test failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
"1" * 2 and "1" * "2" are now valid String#* calls. Only 1 * "2" (numeric receiver with string arg) remains an error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
github-actions Bot
pushed a commit
that referenced
this pull request
Apr 18, 2026
…string-multiply feat: add String#* (string repetition) for TryRuby L80 (#524)
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"Jimmy" * 5→文字列 ("Jimmy") . [*▼] ( (5) )ブロックにマッピングreceiver * argを生成(Ruby 慣例に合わせる)_addNumberInputで処理(型不一致を回避)Test Coverage
"Jimmy" * 5変換テスト*中置記法生成テスト + finishTargets インライン化テストsay("Jimmy" * 5, 2)→ 完全一致Refs #524 (Phase 1 #2)