Skip to content

Improve error reporting: Detect module declarations that incorrectly end with = #1214

@DanTup

Description

@DanTup

Depending on whether you have a namespace or not, a module declaration may or may not require an =. This caught me out today (it's been a long time since I did any F#); I created a new file and deleted the namespace and got this compile error:

Files in libraries or multiple-file applications must begin with a namespace or module declaration

As I had some F# code open in my browser that had module blah = I copied it and continued to get the same message:

fsharp2

In hindsight, the example given in the message doesn't have an = so I should've figured it out, but it actually took much googling and finding a comment on this answer that made me realise the issue.

I think it might be worthwhile calling this out in the message (or ideally, detecting when there is a module declaration with an = that shouldn't be there and giving a specific message). It seems effort is going into improving messages in #1103.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions