Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Absolutionism
Copy link
Contributor

Problem

When creating a SyntaxElement and including an optional multi-typed expression in the pattern ([%type1/type2%]) then having a defaultExpression for the ClassInfo of type2 but not for type1, SkriptParser fails to check if any of the types have a defaultExpression.
Resulting in a SkriptAPIException since type1 does not have a defaultExpression

Solution

Adds #getDefaultExpressions which will check every ClassInfo of ExprInfo to retrieve all available DefaultExpressions.
Changes #getDefaultExpression to return the first object from #getDefaultExpression
When no DefaultExpression are available, combines error messages and codenames for 1 SkriptAPIException

Testing Completed

manual

Supporting Information

N/A


Completes: #8079
Related: none

@Absolutionism Absolutionism requested review from a team as code owners July 26, 2025 22:11
@Absolutionism Absolutionism requested review from UnderscoreTud and erenkarakal and removed request for a team July 26, 2025 22:11
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jul 26, 2025
@Absolutionism Absolutionism added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. and removed needs reviews A PR that needs additional reviews labels Jul 26, 2025
@Absolutionism Absolutionism moved this to In Review in 2.12 Releases Jul 26, 2025
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jul 26, 2025
@Absolutionism Absolutionism requested a review from sovdeeth July 27, 2025 04:13
Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember to verify changes! most of the missing spaces would have be caught with a quick check

this method is also a good candidate for a junit test, since you can easily make an ExprInfo

@Absolutionism
Copy link
Contributor Author

this method is also a good candidate for a junit test, since you can easily make an ExprInfo

I opted for a JUnit test of calling #getError on the Enum values.
But if you would still like for me to make a test for #getDefaultExpressions I can do that too. Would have to make it public though.

@Absolutionism Absolutionism requested a review from sovdeeth July 27, 2025 08:20
@sovdeeth
Copy link
Member

sovdeeth commented Jul 27, 2025

this method is also a good candidate for a junit test, since you can easily make an ExprInfo

I opted for a JUnit test of calling #getError on the Enum values.
But if you would still like for me to make a test for #getDefaultExpressions I can do that too. Would have to make it public though.

You shouldn't need to make it public, if the junit test is in the same package but under the test folder then it should be able to access package private methods. It's also better to test more methods than fewer, so having a test for the full thing would be good.

@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Jul 30, 2025
Copy link
Member

@Efnilite Efnilite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for the rest of the tests in the classes

@Absolutionism Absolutionism requested a review from Efnilite August 1, 2025 16:12
Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks pretty good overall

@skriptlang-automation skriptlang-automation bot added the patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. label Aug 1, 2025
@github-project-automation github-project-automation bot moved this from In Review to Awaiting Merge in 2.12 Releases Aug 1, 2025
@APickledWalrus APickledWalrus merged commit 23a00b2 into SkriptLang:dev/patch Aug 1, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.12 Releases Aug 1, 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 patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. labels Aug 1, 2025
@sovdeeth sovdeeth moved this from Done - Awaiting Release to Done - Released in 2.12 Releases Aug 1, 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.
Projects
Status: Done - Released
Development

Successfully merging this pull request may close these issues.

4 participants