fix: correct power operator guard (!value === 10 → value !== 10)#536
Merged
Conversation
The guard \`!receiver.value === 10\` was parsed as \`(!receiver.value) === 10\`, which is always false. This caused ALL numeric ** operations (e.g. 2 ** 8) to be incorrectly converted to the \`10 ^\` math operator, changing the base from the original value to 10. Fix: change to \`receiver.value !== 10\` so only \`10 ** n\` maps to \`10 ^\`. Other bases (e.g. 2 ** 8) now correctly return null from this handler. Note: non-10 base power (2 ** 8) still cannot be converted to blocks (no Scratch equivalent). This is tracked as a known limitation. Refs #529 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
🚀 Preview deployed: https://smalruby.jp/smalruby3-editor/fix/power-operator-base/ |
github-actions Bot
pushed a commit
that referenced
this pull request
Apr 18, 2026
…rator-base fix: correct power operator guard (`!value === 10` → `value !== 10`)
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
!receiver.value === 10は(!receiver.value) === 10と解釈され常に false。2 ** 8 が 10 ** 8 に変換されるバグの原因。Fix
receiver.value !== 10に修正。10 ** n のみ10 ^演算子にマッピング。Note
10 以外のべき乗(2 ** 8 等)はブロックに変換できない(Scratch に等価な演算子がない)。既知の制限。
Found during Playwright testing on smalruby.app.
Refs #529