microsoft / microsoft/TypeScript

Compiler crash: Debug Failure in visitEachChildOfIndexSignatureDeclaration

Abierto
#63,230 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Bug Domain: Crashes
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

🔎 Search Terms

typescript debug failure index signature
visitEachChildOfIndexSignatureDeclaration
typescript compiler crash decorator addInitializer
invalid index signature decorator
typescript Debug Failure index signature

🕗 Version & Regression Information
  • This is the behavior in the version I tested (TypeScript 5.9.3). I reviewed the FAQ and did not find entries related to this compiler crash.
⏯ Playground Link

https://www.typescriptlang.org/play/?#code/FAMwrgdgxgLglgewgAgIYGd1wgcwCoCeADgKYAUIEAXMgGKSyIQA0yA+rAB40DCANhnQBZEjAAWCACYARElAQAnVDEU8kMEpxgBKAN7BkyA8j6jklAHKoAtiWQBedlwB0EGyWDGOMTs9STJAEkIOHhUPjgALxIFCgZ4JDJxOHQaXQBtAGsSAhp0GAVsHABdVlQIAgBfbWR9Q3rkZPR0y3dnFQBlAqKybWKHcwhnACNsSSSxFO0AbmNq42MFUTAFFHBoBJQAdyUiUgVkCZSacoJmZwvUBRxUtArkGpoANwQ4STr6+Qh0BFNnPgQODIAAMoAJMMhbOIpJD3MgACS6Vq2doILqFXC9SrA7TGQyUZxQcJ8I7oVgXPzXdC4wyVTyVIzAMGCZAACRIfABtWMX3yCjAsEUvX0cwWhgAAoIioRSMZJGiEFCiodtM9Xu88cheb8SP9AWQAERiDkAg005B0ypAA

💻 Code
function assingType(fn: Function, _ctx: ClassMethodDecoratorContext){
  
  let fnName = _ctx.name

  _ctx.addInitializer(function(this: {[key: string], any}) { // here is my sintaxis error
      // Invalid type annotation. The compiler should report a type error,
      // but instead it crashes with "Debug Failure".
      this[fnName.toString()] = fn.bind(this);
  })
  
  return function wrapper (this: any,...args: any ) : void{
    console.log(`class method mame ${fnName.toString()}`)
    fn.call(this, ...args)
  }

} 

class Hello {
  constructor(){

  }
  
  @assingType
  doSometing (): void{
    console.log("hello")
  }
}

🙁 Actual behavior

C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:123168
throw e;
^

Error: Debug Failure.
at visitEachChildOfIndexSignatureDeclaration (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90865:13)
at visitEachChild (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90721:33)
at visitEachChild2 (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:133010:16)
at visitExistingNodeTreeSymbolsWorker (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:132899:23)
at visitExistingNodeTreeSymbols (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:132658:22)
at visitArrayWorker (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90535:49)
at visitNodes2 (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90506:19)
at visitEachChildOfTypeLiteralNode (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90911:7)
at visitEachChild (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90721:33)
at visitEachChild2 (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:133010:16)

🙂 Expected behavior

The TypeScript compiler should not crash.

If the code is invalid, the compiler should emit a normal type error instead of throwing a "Debug Failure" during compilation.

Additional information about the issue

This code does not crash in the TypeScript Playground. The Playground only reports normal type-checking errors.

However, when compiling locally with tsc (TypeScript 5.9.3), the compiler crashes with a "Debug Failure" during compilation.

A screenshot of the stack trace from the local tsc execution is attached.

Image

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza con el código TypeScript proporcionado y reproduce localmente el fallo con tsc 5.9.3; después, compáralo con el resultado del Playground. Sigue la pila desde visitEachChildOfIndexSignatureDeclaration y usa la anotación de firma de índice no válida como caso de enfoque. Se considera terminado cuando el compilador informa de un error de tipos normal en lugar de lanzar Debug Failure.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
compilers
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.