Skip to content

Parser hangs on comment ending with -*/Β #63580

Description

@core-dumpling

πŸ”Ž Search Terms

infinite loop, hyphen, comment, JSDoc

πŸ•— Version & Regression Information

  • This changed between versions 5.4.5 and 5.5.2.
  • This likely changed in commit cd566bad95124aded20f4cd35e95810077500e40.

⏯ Playground Link

No response

πŸ’» Code

import ts from 'typescript';

ts.createSourceFile(
  "t.ts",
  "/**a-*/\nconst x = 1;",
  ts.ScriptTarget.ESNext,
  true,
);

πŸ™ Actual behavior

createSourceFile never returns. The process spins until killed.

πŸ™‚ Expected behavior

The parser should finish normally.

Additional information about the issue

I think this comes from the scanner used for comments that start with /**, even when the comment does not contain any JSDoc tags.
In editors that use the TypeScript language server, this can also leave the project stuck during initialization if one of the files contains this comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions