Skip to content

Improve ExprXOf Literal Handling#8081

Merged
APickledWalrus merged 4 commits intoSkriptLang:dev/patchfrom
APickledWalrus:patch/exprxof-literal-check
Jul 25, 2025
Merged

Improve ExprXOf Literal Handling#8081
APickledWalrus merged 4 commits intoSkriptLang:dev/patchfrom
APickledWalrus:patch/exprxof-literal-check

Conversation

@APickledWalrus
Copy link
Member

Problem

ExprXOf no longer allowed seemingly non-literal inputs (e.g. arithmetic) due to a check it has to prevent literal inputs. This is so that syntax like 10 of diamond instead parses using the itemtype literal parser.

Solution

The solution is to check the source of the literal. If the source of the literal is another literal, it was likely created by the parser (and not from a simplified syntax). The source of parser-created literals will always be a literal. Additionally, I cleaned up the class and corrected a mistake with the return types implementation. It is not correct to simply mirror the possible return types of the source Expression. For example, if the possible return types were ItemStack and Integer (whereas this expression would only return an ItemStack).

Testing Completed

I added a test for a statement that previously failed to parse.

Supporting Information


Completes: none
Related: #8080

@APickledWalrus APickledWalrus requested review from a team and Efnilite as code owners July 25, 2025 01:22
@APickledWalrus APickledWalrus added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Jul 25, 2025
@APickledWalrus APickledWalrus requested a review from a team as a code owner July 25, 2025 01:22
@APickledWalrus APickledWalrus requested review from UnderscoreTud and cheeezburga and removed request for a team July 25, 2025 01:22
@APickledWalrus APickledWalrus changed the base branch from master to dev/patch July 25, 2025 01:22
@APickledWalrus APickledWalrus moved this to In Review in 2.12 Releases Jul 25, 2025
@APickledWalrus APickledWalrus linked an issue Jul 25, 2025 that may be closed by this pull request
1 task
@github-project-automation github-project-automation bot moved this from In Review to Awaiting Merge in 2.12 Releases Jul 25, 2025
@skriptlang-automation skriptlang-automation bot added the patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. label Jul 25, 2025
@APickledWalrus APickledWalrus merged commit dbbe916 into SkriptLang:dev/patch Jul 25, 2025
5 of 7 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.12 Releases Jul 25, 2025
@skriptlang-automation skriptlang-automation bot added completed The issue has been fully resolved and the change will be in the next Skript update. and removed patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. labels Jul 25, 2025
@sovdeeth sovdeeth moved this from Done - Awaiting Release to Done - Released in 2.12 Releases Aug 1, 2025
erenkarakal pushed a commit to erenkarakal/Skript that referenced this pull request Nov 26, 2025
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. completed The issue has been fully resolved and the change will be in the next Skript update.

Projects

No open projects
Status: Done - Released

Development

Successfully merging this pull request may close these issues.

Arithmetic with expressions not working

4 participants

Comments