Conversation
Object.prototype.toString.call(new Date()) returned "[object Object]" instead of "[object Date]". A Perry Date is a NaN-boxed pointer to a DateCell (#2089), and js_object_to_string (object/mod.rs) discriminated heap pointers into Array/Error/Object by GC-header type but had no Date arm, so dates fell through to the generic Object tag. Added a crate::date::is_date_value check (the same brand predicate instanceof Date uses) before the heap discrimination, covering valid dates and Invalid Date alike. Advances the Date conformance issue (#4031).
proggeramlug
added a commit
that referenced
this pull request
Jun 2, 2026
#3961) (#4048) * test(buffer): lock Uint8Array.prototype.buffer ArrayBuffer return type (#3961) * ci(file-size): allowlist object/mod.rs trunk (2 LOC over after #4039-#4041) The #1103 object.rs split trunk crossed the 2000-line gate on current main; splitting the cache/root-scanner groups into siblings is tracked under #1435. Matches the existing global_this/field_get_set/class_registry allowlist precedent. Unblocks lint for all PRs. --------- Co-authored-by: Ralph Küpper <ralph@skelpo.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Object.prototype.toString.call(new Date())returned"[object Object]"instead of"[object Date]".A Perry
Dateis a NaN-boxed pointer to aDateCell(#2089).js_object_to_string(crates/perry-runtime/src/object/mod.rs) discriminates heap pointers intoArray/Error/Objectby GC-header type but had noDatearm, so dates fell through to the genericObjecttag.Fix
Added a
crate::date::is_date_value(value)check — the same brand predicateinstanceof Dateuses — immediately before the heap-pointer discrimination. Covers valid dates and Invalid Date (new Date(NaN)) alike.Verification
Object.prototype.toString.call(new Date())/new Date(0)/new Date(NaN)→"[object Date]", matching Node.util/types,util/inspect,date,globals(74 fixtures): all 6 remaining diffs are pre-existing and unrelated —util/inspect/error-cause-and-aggregate(stack-trace fidelity),util/inspect/boxed-and-symbols(boxed-Stringlengthenumeration, no Date),globals/builtin-name-length-descriptors(runtime: complete own name/length descriptors on builtins (follow-on to closed #3143) #3655),globals/storage-globals(web-storage; Node has none by default), and the twowebassembly-*(deep WASM metadata). Date instance methods (toISOString/getTime/instanceof) and theArrayBuffer/Array/Error/Objecttags are unchanged.Advances the Date conformance issue (#4031).