dotnet / dotnet/fsharp

Compiler silently drops diagnostics with unknown range

Aperta
#14,653 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Area-Diagnostics Bug Impact-Medium
Lingua principale
F#
Stelle
4.3k
Fork
876
Merge medio
4g 22h
PR unite (30g)
144

Descrizione

If a diagnostic would be emitted but it has an unknown range, we sometimes drop it on the floor. This seems non-ideal.

**Repro steps**

See the F# compiler built from https://github.com/Smaug123/fsharp-1/commit/76ea258b45dbea90e2ea28069d76065f1de6c354 . The test "Three types refined to obj are all warned" in ObjInference.fs incorrectly fails because it reports that no diagnostics were emitted. In fact diagnostics were requested, but were suppressed just before reporting: place a breakpoint at FSharpDiagnostic.fs line 203 in `ReportDiagnostic` to observe our decision not to emit the errors that arose on [line 185 of TypeRelations.fs](https://github.com/Smaug123/fsharp-1/commit/76ea258b45dbea90e2ea28069d76065f1de6c354#diff-99e9d8b56b1879061a50d28265e437772930bfe5c5ba465ede161a735e19adafR185) because their associated ranges were all the unknown range.

**Expected behavior**

The test "Three types refined to obj are all warned" should pass, because it notes that three diagnostics were emitted.

**Actual behavior**

No diagnostics were emitted, so the test fails.

**Known workarounds**

We could possibly just make sure that every diagnostic always has a meaningful range (which seems invasive and difficult), or we could run in "all errors" mode (but I don't understand the implications of that).

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con il test "Three types refined to obj are all warned" in ObjInference.fs e riproduci le diagnosi mancanti. Esamina ReportDiagnostic in FSharpDiagnostic.fs alla riga 203 e il percorso che produce le diagnosi in TypeRelations.fs alla riga 185, quindi determina come devono essere gestiti gli intervalli sconosciuti. Il lavoro è completato quando il test passa e conferma che vengono emesse le tre diagnosi.

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

Valutazione

Stack tecnologico
fsharp
Ambito
compilers
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.