dotnet / dotnet/fsharp

Improve error reporting: Namespace and Module collisions

Open
#12,522 0 comments 2 reactions 1 assignee Claimed by @KevinRansom View on GitHub
Area-Diagnostics Bug Impact-Low Needs-Confirmation
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

Given a file that has this Module:

```
Module A.B
```

and another with

```
Namespace B
```

The resulting error is

```
C:\Users\...\A.fs(1,8): error FS0247: A namespace and a module named 'Generator' both occur in two parts of this assembly...
```

I found it very difficult to track this down, although it is quite evident what you see it, if you understand the underlying .NET structures. It would be even more difficult to solve this without that understanding. I have the understanding and needed help to see this.

Since there are many places names can be reused in F#, I think it's important to make this problem clear when someone encounters it.

I think a better error message would be:

```
C:\Users\...\A.fs(1,8): error FS0247: A module name and a namespace name conflict: The name 'B' in 'Namespace B' conflicts with the name 'B' in 'Module A.B'.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.