Fix int/float coercion according to the execution algo #4492
+15
−21
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.
Resolves #4488
This is kind of ... hard to assess where to best put this. I've put it in the scalar serialize as it felt the most appropriate, we could also put it in
completeValue
and returnnull
regardless of whether this is an int/float scalar. We should however not throw errors so instead we'd return NaN from the scalars then instead of null and catch that incompleteValue
.I found it a bit awkward to disregard the value completely for other types so I opted to put it in the scalars for that reason, i.e. there could be legitimate use cases for test-results or others where N/A is different from null.
We are sacrificing some form of accuracy here as a non-nullable field will return "cannot return null for x" when NaN is supplied while we do become more accurate by returning null for a nullable field rather than an error.