Fix ExprArithmetic Type Resolutions #7976
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Currently, ExprArithmetic does not properly consider Converters (Converted Arithmetic Infos) when determining return types along with UnparsedLiteral resolutions. This led to some unexpected test failures when working on #7892
Solution
I added two new methods,
lookupLeftOperationsandlookupRightOperationsfor performing OperationInfo lookups (with converters) when only partial information is available. I usedlookupas that method seems to be used when Converters are considered, whereasgetis for exact looksup.Testing Completed
I have added a test case in
ExprArithmetic.skthat tests the behavior against Experience. Here's what goes wrong currently:When parsing for the line starts, the Operation information is
Experience + UnparsedLiteral (Object). When searching forExperience + <anything>operations, Skript finds nothing, as Converters are not attempted. However, it should findNumber + NumberasExperience -> Numberis a registered Converter. Thus, by checking conversions, this line now parses successfully.Supporting Information
Completes: none
Related: none