Skip to content

warnings for invalid #nowarn arguments #17870

Closed
@Martin521

Description

@Martin521

Working on "scoped nowarn", I came across the following items.

  1. With SDK 8.0, a directive #nowarn "FS0020" creates a warning "Invalid warning number 'FS0020'".
    With the current compiler and "--langversion:8.0", there is no warning. (It got lost in Allow ParsedHashDirectives to take non string arguments #17206.)
    The warning should be brought back for "--langversion:8.0".

  2. I also propose to introduces (under the F# 9.0 language flag ParsedHashDirectiveArgumentNonQuotes) warnings for invalid nowarn arguments like in #nowarn "xyz". Specifically, for arguments that do not match the format (FS)?\d+ (for directives) or [A-Z]*\d+ (for compiler options).

  3. Independent of the language version, the range of the argument (rather than the whole directive) should be used for the warning, making it more precise.

Draft PR exists (#17871)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions