Skip to content

Misleading error when a type and a namespace share the same name #17827

Description

@auduchinok

Consider this library project:

File1.fs:

namespace Ns.TypeName

File2.fs:

namespace Ns

type TypeName = { Field: int }

There's a name collision between the namespace in the first file and the type in the second one, and there's an error building this project. However, the error is misleading:

File1.fs(1,14): Error FS0247 :
  A namespace and a module named 'Ns.TypeName' both occur in two parts of this assembly

When trying to investigate such an error, you try to find a module TypeName, but there's none, so it's quite hard to diagnose on bigger projects.

Here's the repro project: SameNameNamespaceType.zip.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Diagnosticsmistakes and possible improvements to diagnosticsBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    Projects

    Status
    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions