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

Support for <WarnOn> MSBuild property #379

Open
NinoFloris opened this issue Jul 5, 2022 · 5 comments
Open

Support for <WarnOn> MSBuild property #379

NinoFloris opened this issue Jul 5, 2022 · 5 comments

Comments

@NinoFloris
Copy link

NinoFloris commented Jul 5, 2022

F# 6.0 SDK released with support for specifying warnings via a new MSBuild property which isn't picked up by Rider yet.
dotnet/fsharp#10885

I'm assuming to light this up, support needs to be added over here? https://github.com/JetBrains/resharper-fsharp/blob/b3bdd454313fb4b32e924ad5b72238245f020f7c/ReSharper.FSharp/src/FSharp.Psi.Daemon/src/Stages/FSharpCompilerWarningProcessor.fs

@auduchinok
Copy link
Member

@NinoFloris Could you please share a small repro solution showing where Rider doesn't show a warning while the console build does?

The example from dotnet/fsharp#13437 doesn't produce any additional warning during build for me.

I've also checked it with FS3180 and got no warnings produced by FCS inside neither Rider nor Visual Studio, so it'd be better to report it to FCS.

@auduchinok
Copy link
Member

The FS3180 case is now reported to FCS: dotnet/fsharp#13442.

@NinoFloris
Copy link
Author

NinoFloris commented Jul 6, 2022

I see, I've changed the repro in the F# issue, there is apparently more broken in the compiler around 3395.

You should now see a warning appear under StringValues("1") when 3395 is specified via OtherFlags, but none via WarnOn

For complete reference:

repro

open System

// Minimized copy for demonstration of Microsoft.Extensions.Primitives.StringValues
type StringValues(v: string) =
    static member op_Implicit(values: StringValues): string = ""
    
type Foo(_v: Nullable<int>) =
    member val Test: Nullable<int> = 0 with get,set // Warning for 3391 as I would have interpreted it.
    member val StringValue: string = "" with get,set
    
    static member Create() =
      let value = 1
      let instance = Foo(value, Test = value) // No warning on either the argument or the property setter?
      instance.Test <- value // No warning for 3395 and 3391?
      instance.StringValue <- StringValues("1") // Warning for 3395
      
      let mutable test: Nullable<int> = value // Warning for 3391 as I would have interpreted it.
      
      // Warning for 3391 but it's syntactically identical to the line that had no warning and one that had 3395???
      test <- 1 

fsproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
<!--  Warning when uncommented  -->
<!--    <OtherFlags>$(OtherFlags) &#45;&#45;warnon:3395</OtherFlags>-->

<!--  No warning when uncommented  -->
    <WarnOn>$(WarnOn); 3395</WarnOn>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Program.fs" />
  </ItemGroup>
</Project>

@NinoFloris
Copy link
Author

@auduchinok can you confirm the example repros?

@auduchinok
Copy link
Member

@NinoFloris Yes, I can repro the OtherFlags vs WarnOn difference, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants