Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[P2] Tests: lazy class storage test expects erased declare fields at runtime

Aperta Adatta ai principianti
#2,829 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp, typescript
Ambito
compilers, testing

Direzione di ricerca

Trova LazyClassFieldStorageTests.GenericDeclareAndComputedInitializers_MaterializeAndVerify e controlla il suo output previsto insieme al codice sorgente TypeScript fornito. Esegui il test per confermare la discrepanza; il lavoro è completato quando viene aggiornato solo l’output previsto in modo che corrisponda al risultato di Node, preservando il codice sorgente e l’asserzione completa di verifica IL.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug priority: P2

The existing compiler test LazyClassFieldStorageTests.GenericDeclareAndComputedInitializers_MaterializeAndVerify expects a declare field to exist on the emitted instance and contain null.

Its unchanged source is:

const key: string = "computed";
class Box<T> {
    value: T;
    declare absent: any;
    [key]: number = 2;
    constructor(value: T) { this.value = value; }
}
const box: any = new Box<number>(3);
console.log(box.value, box.absent, box.computed,
    Object.hasOwn(box, "absent"), Object.hasOwn(box, "computed"));

Strict TypeScript accepts this source. Node prints:

3 undefined 2 false true

The test still expects:

3 null 2 true true

A declare field is erased, so the Node result is the intended runtime behavior. Both the tested compiler parent and the candidate for #2737 produce the correct result after complete IL verification with only System assembly references. The assertion therefore fails on both; this is a stale test oracle, not a runtime regression from #2737.

Update the expected output while preserving the complete source and the existing IL-verification assertion. Found while expanding #2737 validation. The original test was added with the lazy-storage work associated with #1459.

Lingua principale
C#
Stelle
156
Fork
4
Merge medio
4h 52m
PR unite (30g)
45

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nickna/SharpTS

Tutte le issue di nickna/SharpTS

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.