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
Fix ExprDifference issues #5406
Merged
sovdeeth
merged 6 commits into
SkriptLang:dev/feature
from
APickledWalrus:fix/expr-difference-issues
Jan 1, 2024
Merged
Fix ExprDifference issues #5406
sovdeeth
merged 6 commits into
SkriptLang:dev/feature
from
APickledWalrus:fix/expr-difference-issues
Jan 1, 2024
Conversation
This file contains 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
APickledWalrus
added
the
bug
An issue that needs to be fixed. Alternatively, a PR fixing an issue.
label
Jan 28, 2023
kiip1
approved these changes
Jan 28, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :)
AyhamAl-Ali
approved these changes
Jan 28, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR my associate ⚡
We will now attempt to convert into the type that has a math. If the first type has a math but the second type can't be converted, we will then try the second type's math
TheLimeGlass
previously requested changes
Feb 25, 2023
Moderocky
force-pushed
the
master
branch
2 times, most recently
from
September 16, 2023 16:59
bd134d0
to
3f08853
Compare
UnderscoreTud
approved these changes
Oct 2, 2023
APickledWalrus
added
the
needs testing
Needs testing to determine current status or issue validity, or for WIP feature pulls.
label
Nov 8, 2023
APickledWalrus
removed
the
needs testing
Needs testing to determine current status or issue validity, or for WIP feature pulls.
label
Nov 22, 2023
sovdeeth
added
2.8
Targeting a 2.8.X version release
feature-ready
A PR/issue that has been approved, tested and can be merged/closed in the next feature version.
labels
Dec 30, 2023
sovdeeth
approved these changes
Dec 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
2.8
Targeting a 2.8.X version release
bug
An issue that needs to be fixed. Alternatively, a PR fixing an issue.
feature-ready
A PR/issue that has been approved, tested and can be merged/closed in the next feature version.
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.
Description
This PR aims to fix some issues, mainly with the initialization stage of ExprDifference.
There were multiple issues, but the main one (which is why #5331 had test failures) is that it does not properly compare known types. For example, if we had two types,
string
andnumber
, the resolved class info isobject
(it's the shared superclass). Of course, this expression has handling for variables that allowsobject
as a valid classinfo. However, this meant that thestring
andnumber
difference would be accepted. This caused Skript to interpret the following line incorrectly in some cases:difference between "%{_a}%" parsed as a number and "%{_b}%" parsed as a number
It should be interpreted as:
difference between ("%{_a}%" parsed as a number) and ("%{_b}%" parsed as a number)
However, because of the faulty checks, it would sometimes be interpreted as:
(difference between ("%{_a}%" parsed as a number) and "%{_b}%") parsed as a number
So, I've cleaned up the class, and the new logic is as follows:
If we have two known types:
If we have one known type:
If we have no known types:
In the PR I mentioned above, ExprParse was sometimes registered before ExprDifference which is why this error occurred. It's not problematic right now because ExprDifference is registered before ExprParse (but we shouldn't depend on load order to prevent bugs!!)
Thorough review of the logic and additional testing is likely needed
Target Minecraft Versions: Any
Requirements: None
Related Issues: none?