Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Allow multiple potential return types & defer expression type checking.

Open Moderocky opened this issue 1 year ago • 0 comments

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 avatar Apr 29 '24 12:04 Moderocky