-
-
Notifications
You must be signed in to change notification settings - Fork 407
Implement type-aware function argument parsing #8098
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
sovdeeth
merged 13 commits into
SkriptLang:dev/patch
from
APickledWalrus:patch/function-parsing-types
Aug 29, 2025
Merged
Implement type-aware function argument parsing #8098
sovdeeth
merged 13 commits into
SkriptLang:dev/patch
from
APickledWalrus:patch/function-parsing-types
Aug 29, 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
Efnilite
reviewed
Jul 31, 2025
src/main/java/ch/njol/skript/lang/function/FunctionRegistry.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/lang/function/FunctionRegistry.java
Outdated
Show resolved
Hide resolved
Efnilite
reviewed
Jul 31, 2025
1 task
1 task
Efnilite
approved these changes
Aug 8, 2025
Efnilite
reviewed
Aug 10, 2025
sovdeeth
approved these changes
Aug 17, 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.
enhancement
Feature request, an issue about something that could be improved, or a PR improving something.
needs testing
Needs testing to determine current status or issue validity, or for WIP feature pulls.
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
This PR addresses multiple issues. First, list parsing behavior is duplicated within SkriptParser rather than centralized in one method.
Additionally, since function overloading was added, literal parameters (for conflicting literals) would fail to parse properly (that is, as the expected type).
Consider the following example:
Solution
List parsing has been re-written. The underlying code/process is generally the same, just better formatted and organized. The handling of plural types (consider ExprInfo such as
%number/booleans%
) has been rewritten to work "properly". Previously, only the first argument was used. Now, the entire array is considered against the parsed expressions:Function argument parsing has also been rewritten. Previously, function arguments were parsed as any possible expression (i.e. expecteing Object as the return type). Now, function arguments are parsed based on the possible parameter types. For all possible signatures, an ExprInfo is created for each parameter index. Consider the following example:
Now, when attempting to parse
test(INPUT)
it will only attempt to parseINPUT
as a string or boolean, rather than any value.Further testing of performance and stability is needed.
Testing Completed
The
StructFunction
test has been expanded with a test case for conflicting literal parameters.Supporting Information
Completes: none
Related: none