Skip to content
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

Allow multiple potential return types & defer expression type checking. #6624

Merged
merged 13 commits into from
May 31, 2024

Conversation

Moderocky
Copy link
Member

Description

Fixes weird parse error from converted object return types.

send health of {z} / max health of {z} was originally interpreted as send health of ({z} / max health of {z}) since the arithmetic has an Object return type, which is vacuously convertible to LivingEntity.

This change does several things:

  1. Expressions can now return an array of multiple possible return types (by default this is an array of the getReturnType())
  2. Expressions now have authority over whether something is a valid return type of theirs (by default this checks if it's assignable to one of the possible types)
  3. Parser (and converted expressions) now use this method

This now means that: 1. fewer things are converted (when they don't need to be) 2. things are less likely to attempt a conversion when it's inconceivable for it to be correct.

Note: there should be no breaking changes for any existing syntax.


Target Minecraft Versions: any
Requirements: none
Related Issues: fixes #6623

@Moderocky Moderocky added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Apr 29, 2024
@Moderocky Moderocky requested a review from UnderscoreTud April 29, 2024 12:35
@Moderocky Moderocky requested a review from UnderscoreTud April 29, 2024 13:29
Copy link
Member

@AyhamAl-Ali AyhamAl-Ali left a comment

Choose a reason for hiding this comment

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

✅ Day 18 of Kenzie hugely improving Skript.

@Moderocky Moderocky requested a review from UnderscoreTud April 29, 2024 16:26
@Moderocky Moderocky added the 2.9 Targeting a 2.9.X version release label May 1, 2024
@Moderocky Moderocky requested a review from APickledWalrus May 10, 2024 12:26
@sovdeeth sovdeeth added patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. 2.8 Targeting a 2.8.X version release and removed 2.9 Targeting a 2.9.X version release labels May 29, 2024
Moderocky and others added 11 commits May 31, 2024 12:35
… math.sk

Co-authored-by: Ayham Al Ali <20037329+AyhamAl-Ali@users.noreply.github.com>
… math.sk

Co-authored-by: _tud <98935832+UnderscoreTud@users.noreply.github.com>
Co-authored-by: Ayham Al Ali <20037329+AyhamAl-Ali@users.noreply.github.com>
Co-authored-by: _tud <98935832+UnderscoreTud@users.noreply.github.com>
Also enables the usage of multiple converters to further avoid conversion loss
@Moderocky Moderocky merged commit a4a72d0 into SkriptLang:dev/patch May 31, 2024
5 checks passed
@Moderocky Moderocky deleted the fix-6623 branch May 31, 2024 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.8 Targeting a 2.8.X version release bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants