Skip to content

compiled: built-in constructor Type tokens mis-tag as non-functions in toString-tag dispatch (lodash isFunction(Object) === false) #314

Description

@nickna

Summary

In compiled mode, built-in constructors held as values (the System.Type token representation — Object, Date, Array, ...) report typeof === "function", but tag-based classification (Object.prototype.toString.call(x) / lodash''s baseGetTag) does not produce [object Function] for them. lodash''s isFunction(Object) therefore returns false and baseIsNative falls into the host-constructor path (reIsHostCtor), which happens to match, so lodash init survives — but the divergence is observable to any guest code that classifies by toString tag.

Observed while validating #307 against compiled lodash:

DBG baseIsNative: value=function   // typeof Object
DBG b4 f=false                     // lodash isFunction(Object) — wrong, true in Node

Repro sketch

var O = Object;
console.log(typeof O);                                   // "function" (correct)
console.log(Object.prototype.toString.call(O));          // expected "[object Function]"

Suggested direction

The toString-tag dispatch (wherever ObjectToString/baseGetTag-visible tagging happens for System.Type receivers) should classify constructor Type tokens as [object Function], matching their typeof.

Environment

  • branch fix/307-inner-fndecl-arrow-capture; .NET 10.0, Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions