dotnet / dotnet/fsharp

Error FS0001 instead of FS0249 for overlapped names

Offen
#4,601 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Area-Diagnostics Bug Impact-Low
Vorherrschende Sprache
F#
Sterne
4.3k
Forks
876
Ø Merge
5 T. 9 Std.
Gemergte PRs (30 T.)
153

Beschreibung

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
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Erstelle die Reproduktion mit zwei Dateien aus file1.fs und file2.fs, kompiliere sie in der angegebenen Reihenfolge und vergleiche die Diagnose mit dem erwarteten und tatsächlichen Verhalten des Issues. Als erledigt gilt dies, wenn die überlappenden Definitionen FS0249 statt des irreführenden Typkonfliktfehlers FS0001 erzeugen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
fsharp
Bereich
compilers
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.