Skript
Skript copied to clipboard
Allow multiple potential return types & defer expression type checking.
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:
- Expressions can now return an array of multiple possible return types (by default this is an array of the
getReturnType()) - 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)
- 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