Skip to content

TypeScript 7.0.2 scanner does not advance on bare hash #64490

Description

@yum45f

Version

TypeScript 7.0.2

Reproduction

npm install typescript@7.0.2
node --input-type=module -e 'import { createScanner, LanguageVariant, SyntaxKind } from "typescript/unstable/ast"; const scanner=createScanner(false,LanguageVariant.Standard,"#"); for(let i=0;i<2;i++){const token=scanner.scan(); console.log(SyntaxKind[token], scanner.getTokenStart(), scanner.getTokenEnd())}'

Actual output:

PrivateIdentifier 0 0
PrivateIdentifier 0 0

The scanner repeatedly returns the same non-EOF token without moving from offset 0. A loop that scans until EndOfFile therefore never terminates on a bare # (including when a later comment appears in the same source). Expected: scanning malformed input advances or returns EOF so consumers can terminate. A bare # followed by an identifier scans normally.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions