Skip to content

NaN is lexed as a number, not as an identifier #421

@Razican

Description

@Razican

Describe the bug
In #397, we modified NaN to be lexed as a number, and not as an identifier. This fixed the most common case of using NaN, that wouldn't work before, but it won't work for Number.NaN, among others.

To Reproduce
This now fails:

Number.NaN;

Expected behavior
This should produce NaN, since it's almost the same case, but it produces a parsing error.

Additional context
We will need to add the associated constant to the "Global" object and to the "Number" for this to work, and make sure that an identifier in the global scope tries to access the constant in the global object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-EasyEasybugSomething isn't workinggood first issueGood for newcomerslexerIssues surrounding the lexer

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions