Skip to content

Fix Uncommon Arithmetic Type Errors #7907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

APickledWalrus
Copy link
Member

Problem

It's possible to for valid operations to fail, and more rarely, type exceptions to occur when using variables with arithmetic operations. This occurs when OperationInfo resolution is delayed to runtime, which is the case for variables.

Solution

This is caused by the resolved OperationInfo being saved for future executions (that is, the field on ArithmeticChain is updated). This unsafe (types can change, hence these issues), so I've updated the code to not modify the field. For future safety, I've made the field final.

Testing Completed

Additional tests in ExprArithmetic.sk were added.

Supporting Information


Completes: none
Related: none

@APickledWalrus APickledWalrus added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Jun 1, 2025
@APickledWalrus APickledWalrus requested a review from a team as a code owner June 1, 2025 00:11
@APickledWalrus APickledWalrus requested review from Efnilite and removed request for a team June 1, 2025 00:11
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jun 1, 2025
@APickledWalrus APickledWalrus requested a review from sovdeeth June 1, 2025 00:11
@APickledWalrus APickledWalrus merged commit 7445172 into SkriptLang:dev/patch Jun 1, 2025
5 checks passed
@APickledWalrus APickledWalrus deleted the patch/arithmetic-switcheroo-errors branch June 1, 2025 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. needs reviews A PR that needs additional reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants