Skip to content

#nowarn in the editor does not ignore warning if --warnaserrors flag is set, but compiler does #9796

@abelbraaksma

Description

@abelbraaksma

(edited, it is not related to --warnon, but to --warnaserrors)

If you have --warnaserror:xxxx, and on file-level you disable that same warning, you still see the errors in that file, while the compiler succeeds. This is confusing.

Repro steps (1)

  1. Add "25" to the Warnings as errors:
    image
  2. Add #nowarn "25" to a source file.
  3. Write code that triggers this warning:
    image

Repro steps (2)

  1. Add warnon:1182 in project settings:
    image
  2. Add FS1182 to the "warnings as errors":
    image
  3. Inside a source file, add #nowarn:1182 at the top
  4. Have a line with an unused variable

image

Expected behavior

Inside a file, the editor should consider the #nowarn directives.

Actual behavior

Apparently, the editor highlighting tooling is aware of the --warnaserror compiler option, but not of the #nowarn directive in the file, and shows the error, while fsc doesn't show an error.

  • It shouldn't show the red squiggles
  • It should (probably) still show the "unused" warning in the mouseover
  • It should keep the ident greyed out

Known workarounds

Don't use these options, or fix your errors. But as seen in #9795, that's not always possible.

Related information

  • It doesn't matter whether you use the UI setting, or add --warnaserror:XXXX to the addition fsc options

Not really related anymore, but FYI, since 1182 is a "special" warning that does not get triggered on any warning level, unless you add the --warnon:XXXX to the options.

In this reaction, back in 2015 (!) (#422 (comment)), @dsyme mentions that opt-in for FS1182 was deliberate. It was done before moving to github, so I cannot find the decision/discussion or changes.

Yes, I do recall this, it's good to have it recorded (and yes, this was one of the reasons /warn:1182 was made opt-in)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions