Boa: [JSON] JSON.stringify(undefined) panics

Created on 18 Jun 2020  路  4Comments  路  Source: boa-dev/boa

In Chrome it returns "undefined".

But in the spec https://tc39.es/ecma262/#sec-json.stringify it says:
image

In boa it panics:

thread 'main' panicked at 'internal error: entered unreachable code: Symbols and Undefined JSON Values depend on parent type', boa/src/builtins/value/mod.rs:264:17
bug builtins

Most helpful comment

I'll look into this.

All 4 comments

I'll look into this.

Behavior in chrome (we should probably have tests for the below cases):
image

@croraf
For your JSON.stringify({ a: undefined }); case, there is this test on master.
For your JSON.stringify() case, there is this test on master.
The JSON.stringify(undefined) case is being addressed in #512
And for your JSON.stringify([6, undefined, 7]) case, there is this test on master.

Oh. I now see NOTE 5 in the spec exactly explains how JSON.stringify(undefined) should be returned.

Was this page helpful?
0 / 5 - 0 ratings