Skip to content

Some values marked as unused do not become warnings when using --warnon:1182 #9936

@TysonMN

Description

@TysonMN

There are some cases in which values are correctly distinguished in Visual Studio as being unused but they do not become warnings when using --warnon:1182.

Reproduction Steps

Consider the following code (zip of solution) in which x, y, and z are all unused.

module Top
type Foo =
  { Bar: Unit }
  member x.Baz() = ()
let private y = ()
let f z = ()

Visual Studio correctly displays them as unused via the darker font color and tool tips mention FS1182.

x tooltip

val x : Foo
FS1182: The value is unused

y tooltip

val private y : unit
Full name: Top.y
FS1182: The value is unused

z tooltip

val z : 'a
FS1182: The value is unused

Now to the project file, add

<OtherFlags>$(OtherFlags) --warnon:1182</OtherFlags>

Expected Behavior

I expected there to be three warnings...one for each unused value.

Actual Behavior

There is only one warning (screenshot), and it is for z. The tooltip for z also changes slightly.

new z tooltip

val z : 'a
FS1182: The value is unused
FS1182: The value 'z' is unused

Known workarounds

None

Related information

  • Operating system: Windows 10
  • .NET Runtime kind: .NET Core 3.1
  • Editing Tools: Visual Studio Enterprise 2019 version 16.7.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions