Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#nowarn to be interpreted consistently in fsi #10535

Open
smoothdeveloper opened this issue Nov 24, 2020 · 1 comment
Open

#nowarn to be interpreted consistently in fsi #10535

smoothdeveloper opened this issue Nov 24, 2020 · 1 comment
Labels
Area-Compiler-Syntax lexfilter, indentation and parsing Area-FSI Feature Request
Milestone

Comments

@smoothdeveloper
Copy link
Contributor

with nowarn.fsx containing the following:

#nowarn "1104"
let ``@nowarn`` = 1

trying to invoke it with

dotnet fsi nowarn.fsx

getting

nowarn.fsx(2,5): warning FS1104: Identifiers containing '@' are reserved for use in F# code generation

If I try to do the same by pasting the contents in interactive session, it hides the warning.

The work around is to use --nowarn when invoking fsi.

Would it make sense to also hide the warnings in the first case?

@cartermp cartermp added this to the Backlog milestone Feb 6, 2021
@vzarytovskii vzarytovskii moved this to Not Planned in F# Compiler and Tooling Jun 17, 2022
@abelbraaksma abelbraaksma added the Area-Compiler-Syntax lexfilter, indentation and parsing label May 22, 2024
@abelbraaksma
Copy link
Contributor

abelbraaksma commented May 22, 2024

Interesting. I just ran your test in debug session with the compiler and the warning is displayed before the hash-directive is even parsed. Something odd is going on here.

Note, related: #17209.

EDIT: it took me a moment to realize, but this appears to be warning-number specific. I.e., if the warning is thrown inside the lexer, it is not suppressed. However, if it occurs at a later state, it is properly suppressed.

#nowarn "1104"
#nowarn "25"

module Foo =
    let someFunc() =
        match 42 with // warning 25 is suppressed
        | 42 -> "yes"
        | 43 -> "no"

    let ``@nowarn`` = 1 // warning 1104 is not (because raised in lexer)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compiler-Syntax lexfilter, indentation and parsing Area-FSI Feature Request
Projects
Status: New
Development

No branches or pull requests

3 participants