-
-
Notifications
You must be signed in to change notification settings - Fork 391
Literal Multiple Infos Warning #7851
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
Open
Absolutionism
wants to merge
11
commits into
SkriptLang:dev/feature
Choose a base branch
from
Absolutionism:dev/LiteralMultipleWarning
base: dev/feature
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Literal Multiple Infos Warning #7851
Absolutionism
wants to merge
11
commits into
SkriptLang:dev/feature
from
Absolutionism:dev/LiteralMultipleWarning
Conversation
This file contains hidden or 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
sovdeeth
requested changes
May 6, 2025
sovdeeth
requested changes
May 12, 2025
src/main/java/ch/njol/skript/classes/registry/RegistryParser.java
Outdated
Show resolved
Hide resolved
sovdeeth
requested changes
May 13, 2025
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.
seems pretty solid now
sovdeeth
approved these changes
May 13, 2025
sovdeeth
approved these changes
May 14, 2025
APickledWalrus
requested changes
May 16, 2025
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.
Some initial thoughts. I like the idea
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
Feature request, an issue about something that could be improved, or a PR improving something.
needs reviews
A PR that needs additional reviews
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 add a warning when a literal, that can be referenced to multiple ClassInfos/types, is used.
The warning informs the user that the literal can be referenced to multiple types and that they should consider specifying which type to use, using the new literal specification feature introduced in 2.11.
This PR also fixes a bug that was present within
SkriptParser#parseSingleExpr
where when an element's pattern allowed multiple types, includingObject
for an expression (%.../.../object%
) if all other types failed to be parsed and reachedObject
, it did not treat it correctly as seen with the prior condition check (if (exprInfo.classes[0].getC() == Object.class) {
). Which lead to the literal being parsed as the firstClassInfo
that gets registered with that pattern. Now the loop will log if it reachesObject
and continue to attempt every otherClassInfo
. If all fail, andObject
was logged, will use the method#getUnparsedLiteral
which is the code from the aforementioned condition, to prevent duplicated code.With that change, a fix was required for
CondContains
as it did not properly handleUnparsedLiteral
s.Target Minecraft Versions: any
Requirements: none
Related Issues: none