typescript/ast/scanner: scan() never advances past `#` not followed by an identifier start (7.1.0-beta)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 70/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- compilers
Línea de trabajo
Start with the createScanner entry point in typescript/ast/scanner and run the provided reproduction on the three inputs. Trace the # scanning behavior when no identifier start follows, then check existing scanner tests for where to add regression coverage. Done means each scan advances or returns EndOfFile, and the inputs produce tokens that do not repeat at the same position.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🔎 Search Terms
createScanner, scan, PrivateIdentifier, #, infinite loop, scanner does not advance, typescript/ast/scanner
🕗 Version & Regression Information
- Reproduces in
[email protected](typescript/ast/scanner). The JS scanner is used through the new API entry points. - Does not reproduce in
[email protected](ts.createScanner). - Node 22.22.3, Linux x64.
⏯ Playground Link
No response
💻 Code
// node repro.mjs
import { createScanner } from "typescript/ast/scanner";
import { SyntaxKind } from "typescript/ast";
for (const text of ["a # b", "# ", "#1"]) {
const scanner = createScanner(/*skipTrivia*/ true, /*languageVariant*/ undefined, text);
const tokens = [];
for (let i = 0; i < 6; i++) {
const kind = scanner.scan();
tokens.push(`${SyntaxKind[kind]}@${scanner.getTokenStart()}-${scanner.getTokenEnd()}`);
if (kind === SyntaxKind.EndOfFile) break;
}
console.log(JSON.stringify(text), tokens.join(", "));
}
🙁 Actual behavior
When # is not followed by an identifier start, scan() returns PrivateIdentifier with an empty range and never advances, so it never reaches EndOfFile:
"a # b" Identifier@0-1, PrivateIdentifier@2-2, PrivateIdentifier@2-2, PrivateIdentifier@2-2, PrivateIdentifier@2-2, PrivateIdentifier@2-2
"# " PrivateIdentifier@0-0, PrivateIdentifier@0-0, ...
"#1" PrivateIdentifier@0-0, PrivateIdentifier@0-0, ...
Any loop of the form while (scanner.scan() !== SyntaxKind.EndOfFile) hangs on such input.
🙂 Expected behavior
The scanner consumes the # and moves on, as [email protected] does:
"a # b" Identifier@0, PrivateIdentifier@2, Identifier@4, EndOfFileToken@5
"# " PrivateIdentifier@0, EndOfFileToken@2
"#1" PrivateIdentifier@0, NumericLiteral@1, EndOfFileToken@2
(5.9 also reports an "Invalid character" error for the lone #.) At minimum, every scan() call should advance the position or return EndOfFile.
Additional information about the issue
Input like this is common in tooling that scans arbitrary text, such as comments, markdown-ish strings, and partial edits.
- Lenguaje dominante
- Go
- Estrellas
- 112k
- Forks
- 15.4k
- Merge medio
- 2 d 21 h
- PR fusionados (30 d)
- 126
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/TypeScript
-
Won't Fix
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
microsoft/TypeScript#65107 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Native API: formatDiagnosticsWithColorAndContext drops related information without a file locationPosiblemente ocupada @timurzvural la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/TypeScript#65087 ·
Los mantenedores suelen responder en 1 día
-
TS7 LSP: documentHighlight returns nothing when the file path contains '@'Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. AbiertoBug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/TypeScript#64758 ·
Los mantenedores suelen responder en 1 día
-
Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`Posiblemente ocupada @rajnish-verma-22172 la tomó hace 12 días. AbiertoBug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
microsoft/TypeScript#64742 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Class names `eval` and `arguments` are not reported as invalid strict mode bindingsPosiblemente ocupada @dmety la tomó hace 26 días. AbiertoBug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/TypeScript#64661 ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/TypeScript
Issues similares
-
bug good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
[mesheryctl] design delete fails when passing file or URL as positional argumentPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertocomponent/mesheryctl kind/bug language/go
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
meshery/meshery#22772 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
backend security size:S
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
limitlessprojects/Go-Hybrid#3342 ·
Los mantenedores suelen responder en 1 día
-
status/ready type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
buildpacks/pack#2733 ·
Los mantenedores suelen responder en 1 día