Skip to content

Allow #nowarn to support the FS prefix on error codes to disable warnings #17209

@KevinRansom

Description

@KevinRansom

Execute the code in fsi:

let collection () = [
    yield "Hello"
    "And this"
    ]
collection()

And observe the warning:

      "And this"
  ----^^^^^^^^^^
stdin(3,5): warning FS3221: This expression returns a value of type 'string' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'.

As a keen developer you will observe the error ID FS3221 and say I know #nowarn "FS3221" will fix this right smartly.

If you subject this smart idea to reality by executing code similar to:

#nowarn "FS3221"
let collection () = [
    yield "Hello"
    "And this"
    ]
collection()

Reality will reward you with this - quite surprising - error message:

stdin(7,1): warning FS0203: Invalid warning number 'FS3221'

After some time reading around you might decide to try:

#nowarn "3221"
let collection () = [
    yield "Hello"
    "And this"
    ]
collection()

Which will do what you originally wanted.

Let's make FS# work correctly, you know it makes sense.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions