Skip to content

Conversation

@adroitwhiz
Copy link
Collaborator

The documentation for InputShape.Any says (emphasis mine):

Generic shape indicating that any kind of input is acceptable. The input will never be cast, and may be null, undefined, or any JavaScript value.

However, we were previously casting InputShape.Any literals to numbers whenever possible inside staticBlockInputToLiteral. This means that e.g. switch costume to "0" would switch to the 0th costume (which wraps to the last costume) instead of the costume named "0".

I've rewritten staticBlockInputToLiteral to handle each different input shape explicitly, and to only cast InputShape.Number and InputShape.Index to numbers. The logic is the same as Scratch's Cast.toNumber: instead of bailing out if the cast result is NaN, we treat it as 0.

This is what #160 tried to fix, but I believe that fix is not correct. This is an alternative, and hence closes #160.

@adroitwhiz adroitwhiz requested a review from towerofnix January 15, 2026 11:50
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