Skip to content

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

Open

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.

Activity

  1. added this to the Backlog milestone on Oct 2, 2024
  2. added
    Area-Diagnostics
    Impact-Low
    and removed on Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-DiagnosticsBugImpact-Low

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions