Skip to content

JSON tape: console.log() of a non-mutated lazy string array prints [object Object] #1448

@proggeramlug

Description

@proggeramlug

Summary

Under PERRY_JSON_TAPE=1, console.log() of a lazy-tape top-level string array (parsed without a reviver, not yet indexed) prints [object Object] instead of the array contents.

Repro

const arr = JSON.parse('["a","bb","ccc","dddd","eeeee"]');
console.log(arr);

PERRY_JSON_TAPE=1:

[object Object]      // Perry
[ 'a', 'bb', 'ccc', 'dddd', 'eeeee' ]   // Node

Default (tape off) is correct. Surfaced by test_json_sso_strings line ~32 under PERRY_JSON_TAPE=1.

Notes

Separate from #1424 (that was the reviver SIGSEGV, fixed in PR #1447). This is the inspect/format path for a lazy array: console.log's formatter doesn't recognize an un-materialized LazyArrayHeader as an array (the stringify path has redirect_lazy_to_materialized for this; the console.dir/inspect formatter likely needs the same redirect). arr.length / indexed reads work — only the whole-array console.log formatting is wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions