-
-
Notifications
You must be signed in to change notification settings - Fork 399
Fix Syntax Removal #7879
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
Merged
APickledWalrus
merged 5 commits into
SkriptLang:dev/patch
from
APickledWalrus:patch/syntax-removal
Jul 1, 2025
Merged
Fix Syntax Removal #7879
APickledWalrus
merged 5 commits into
SkriptLang:dev/patch
from
APickledWalrus:patch/syntax-removal
Jul 1, 2025
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
This resolves the issue with removals not working
On hold as this results in a lot of syntax conflicts that we can't reasonably resolve. Ideally, pull requests like #7892 should help with this. |
Breaking changes:
|
Absolutionism
approved these changes
Jul 1, 2025
Burbulinis
approved these changes
Jul 1, 2025
Efnilite
approved these changes
Jul 1, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking changes
Pull or feature requests that contain breaking changes (API, syntax, etc.)
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.
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.
Problem
Unregistering syntax via
SyntaxRegistry#unregister
will often fail silently. The issue was caused by the comparator used inSyntaxRegister
not enforcing a consistent order for uniqueSyntaxInfo
s. Currently, elements are ordered first byPriority
. Within the group of elements that share a Priority, it is ordered by registration-order (that is, which one was registered first). This ordering is random and not derived from any properties of the SyntaxInfos themselves. Thus, if I register some SyntaxInfo "A" and then register a whole bunch more, there is no guarantee that a call likeregister.contains(A)
will be successful (it may not reach "A" due to the underlying data structure used).Solution
The issue is resolved by enforcing a consistent ordering. That is, there will always be a consistent ordering for any collection of SyntaxInfos. This means it is no longer safe to simply change registration order to fix conflicts. Of course, this was never safe, and one should instead use Priorities - they are designed for this issue! This consistency accomplished by using hashcodes for ordering SyntaxInfos that share a priority.
Testing Completed
A new JUnit test was introduced in
SyntaxRegistryTest
.Supporting Information
n/a
Completes: none
Related: none