Skip to content

Commit

Permalink
Update CompleteValue() to not return early for NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
leebyron committed Apr 6, 2021
1 parent 64321d5 commit 0f46b62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,10 @@ encoding integer numbers larger than 32-bit.

### Float

The Float scalar type represents signed double-precision finite (i.e., not {NaN}
or {Infinity}) fractional values as specified by
[IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point). Response formats
that support an appropriate double-precision number type should use that type to
represent this scalar.
The Float scalar type represents signed double-precision finite values as
specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).
Response formats that support an appropriate double-precision number type should
use that type to represent this scalar.

**Result Coercion**

Expand All @@ -466,14 +465,18 @@ reasonable without losing information, otherwise they must raise a field error.
Examples of this may include returning `1.0` for the integer number `1`, or
`123.0` for the string `"123"`.

Non-finite floating-point internal values ({NaN} and {Infinity}) cannot be
coerced to {Float} and must raise a field error.

**Input Coercion**

When expected as an input type, both integer and float input values are
accepted. Integer input values are coerced to Float by adding an empty
fractional part, for example `1.0` for the integer input value `1`. All
other input values, including strings with numeric content, must raise a query
error indicating an incorrect type. If the integer input value represents a
value not representable by IEEE 754, a query error should be raised.
error indicating an incorrect type. If the input value otherwise represents a
value not representable by finite IEEE 754 (e.g. {NaN}, {Infinity}, or an
integer above the precision of a float), a query error must be raised.


### String
Expand Down
2 changes: 1 addition & 1 deletion spec/Section 6 -- Execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ CompleteValue(fieldType, fields, result, variableValues):
* If {completedResult} is {null}, throw a field error.
* Return {completedResult}.
* If {result} is {null} (or another internal value similar to {null} such as
{undefined} or {NaN}), return {null}.
{undefined}), return {null}.
* If {fieldType} is a List type:
* If {result} is not a collection of values, throw a field error.
* Let {innerType} be the inner type of {fieldType}.
Expand Down

0 comments on commit 0f46b62

Please sign in to comment.