Skip to content

Fix Uncommon Arithmetic Type Errors#7907

Merged
APickledWalrus merged 2 commits into
SkriptLang:dev/patchfrom
APickledWalrus:patch/arithmetic-switcheroo-errors
Jun 1, 2025
Merged

Fix Uncommon Arithmetic Type Errors#7907
APickledWalrus merged 2 commits into
SkriptLang:dev/patchfrom
APickledWalrus:patch/arithmetic-switcheroo-errors

Conversation

@APickledWalrus
Copy link
Copy Markdown
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
erenkarakal pushed a commit to erenkarakal/Skript that referenced this pull request Nov 26, 2025
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