dotnet / dotnet/fsharp

Error FS0001 instead of FS0249 for overlapped names

Aperta
#4,601 1 commento 1 reazione 0 assegnatari Vedi su GitHub
Area-Diagnostics Bug Impact-Low
Lingua principale
F#
Stelle
4.3k
Fork
876
Merge medio
5g 9h
PR unite (30g)
153

Descrizione

This kind of error might be confusing, especially for beginners learning namespaces and type extensions.

#### Repro steps

Consider two files with a type and the type extension:

```fsharp
// file1.fs
namespace A
type U = T of value : int
```
and
```fsharp
// file2.fs
namespace A
type U = // typo, should be with
member u.Value =
match u with
| T value -> value // error FS0001
```

Compilation order is `file1.fs` then `file2.fs`. There are two errors in the code: type extension should be in form of `type U with ...` and should be placed in a module. But we are considering just the first one.

#### Expected behavior

```
error FS0249: Two type definitions named 'U' occur in namespace 'A' in two parts of this assembly
```

#### Actual behavior

```
error FS0001:
This expression was expected to have type
'A.U'
but here has type
'A.U'
```

#### Related information

```
dotnet --version
> 2.1.100
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Crea la riproduzione composta da due file a partire da file1.fs e file2.fs, compilali nell’ordine indicato e confronta la diagnostica con il comportamento previsto ed effettivo dell’issue. Il lavoro è completato quando le definizioni sovrapposte producono FS0249 invece dell’errore fuorviante di incompatibilità dei tipi FS0001.

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
Specificata chiaramente
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.