Skip to content

Octal literal error is usually duplicated #46810

Closed
@sandersn

Description

@sandersn

The binder issues an error on all octal literals that are in strict mode: inside a class or module.
The checker issues an error on all octal literal types, and octal literal values when the target is es5 or higher or the value is in the initialiser of an enum member.

export enum E {
    A = 12 + 01
}
const orbitol: 01 = 01

Expected: one error on each 01.
Actual: Two errors on each 01.

This means that octal literals nearly always get two errors, because most code targets es5 or higher and is inside a module.

The checker implementation is a bit flabby and inefficient, but is probably the best place to consolidate the errors -- and efficiency doesn't matter much for syntax that's hardly ever used. I don't think it would be difficult to re-create the equivalent of the binder's inStrictMode flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions