Skip to content

Conversation

@Efnilite
Copy link
Member

@Efnilite Efnilite commented Jul 15, 2025

Problem

  1. Fixes overloading for functions with no parameters. Previously, passing no parameters to getFunction or getSignature would match any function with the specified name. Now, passing no parameters will only match functions that also have no parameters.
  2. Fixes overloading for functions with array parameters. Previously, if a function had an array as parameters, any function with the same name of the function would be matched. This would not allow for two version of, for example, clamp to exist. Now, instead of matching any function with the same name, the arguments are actually checked
  3. Removes outdated documentation for FunctionIdentifier (fixes FunctionIdentifier#toString throws NPE #8031)
  4. Adds more detailed error messages to the "function already exists" error (fixes Reimplement existing function type and script #8030)

Solution

  1. Updates candidates to avoid returning any function when zero args are provided in the provided FunctionIdentifier.
  2. First, Adds a single list value check to candidates, so functions like mean actually get matched on argument types. Second, for functions like clamp(1, 2, 3), adds a check to allow 1 to pass as a list. Third, removes outdated code from SkriptParser for parsing single list value params.
  3. Updated documentation.
  4. Improved error message.

Testing Completed

  1. Adds a test.
  2. Existing tests for functions like clamp and mean are sufficient.
  3. NA
  4. NA

Supporting Information

Updates the test for StructFunction with local type hints as this part is now handled by FunctionReference.


Completes: #8030, #8031
Related: none

@Efnilite Efnilite requested a review from a team as a code owner July 15, 2025 12:45
@Efnilite Efnilite 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 15, 2025
@Efnilite Efnilite removed the request for review from a team July 15, 2025 12:45
@Efnilite Efnilite added the 2.12 Targeting a 2.12.X version release. Project ID: 7 label Jul 15, 2025
@Efnilite Efnilite requested review from Burbulinis and TheMug06 July 15, 2025 12:45
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jul 15, 2025
@Efnilite Efnilite requested a review from a team as a code owner July 15, 2025 15:03
@Efnilite Efnilite requested review from UnderscoreTud and removed request for a team July 15, 2025 15:03
@Efnilite Efnilite requested a review from APickledWalrus July 15, 2025 21:39
@skriptlang-automation skriptlang-automation bot added feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. and removed needs reviews A PR that needs additional reviews labels Jul 15, 2025
@sovdeeth sovdeeth merged commit 94a68fb into dev/feature Jul 16, 2025
6 checks passed
@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 feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. labels Jul 16, 2025
Burbulinis pushed a commit to Burbulinis/Skript that referenced this pull request Jul 29, 2025
* init

* fix single list value functions, clamp

* fix dynamic functions

* update docs

* reviews

* skript parser strikes again

* enjoy your holiday pickle

* fix checkstyle
@Efnilite Efnilite deleted the feature/no-fn-params branch August 10, 2025 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.12 Targeting a 2.12.X version release. Project ID: 7 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants