Skip to content

Conversation

APickledWalrus
Copy link
Member

@APickledWalrus APickledWalrus commented Jul 31, 2025

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:

function literal_test(x: entity type):
# fails to parse as "firework" is mistakenly interpreted as an itemtype or visual effect,
# even though for a function call it would only ever be an entity type
literal_test(firework)

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:

# consider %number/booleans%
# should succeed
true and true
true or true
1 or true

# should fail
1 and true
1 and 1

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:

function test(x: string)
function test(x: boolean)

Now, when attempting to parse test(INPUT) it will only attempt to parse INPUT 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

@APickledWalrus APickledWalrus added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. enhancement Feature request, an issue about something that could be improved, or a PR improving something. labels Jul 31, 2025
@APickledWalrus APickledWalrus marked this pull request as ready for review August 8, 2025 19:58
@APickledWalrus APickledWalrus requested review from a team as code owners August 8, 2025 19:58
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Aug 8, 2025
@APickledWalrus APickledWalrus added the needs testing Needs testing to determine current status or issue validity, or for WIP feature pulls. label Aug 8, 2025
@sovdeeth sovdeeth added patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. and removed needs reviews A PR that needs additional reviews labels Aug 17, 2025
@sovdeeth sovdeeth moved this to Awaiting Merge in 2.12 Releases Aug 17, 2025
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Aug 29, 2025
@sovdeeth sovdeeth merged commit b114bfb into SkriptLang:dev/patch Aug 29, 2025
5 of 6 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.12 Releases Aug 29, 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 needs reviews A PR that needs additional reviews patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. labels Aug 29, 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.
Projects
Status: Done - Awaiting Release
Development

Successfully merging this pull request may close these issues.

Function super types still broken for same literals
3 participants