Skip to content

Some warnings are missing #3752

Closed
Closed

Description

@matthid

It seems like some warnings are missing from all recent IDEs (Rider, Visual Studio 2017, Ionide and FSI)

Repro steps

The following code contains a warning, as the generic parameter 'a is constrained to string because of the parameter f in cache.GetOrAdd(_, f):

let internal memoizeBy (getKey : 'a -> string) (f: 'a -> 'b) : 'a -> 'b =
   let cache = System.Collections.Concurrent.ConcurrentDictionary<string, 'b>()
   fun (x: 'a) ->
       cache.GetOrAdd(getKey x, f)

Use this code snippet in recent Visual Studio, Ionide or Rider.

Expected behavior

image

Actual behavior

No Warning at all.

Known workarounds

Use older versions

Related information

There have been reports on Slack that other warnings seem to be no longer shown (like "use new on IDisposable), but I haven't actually verified anything.
If the impact of this are indeed ALL warnings, the severity should be considered very high.
Even if the impact is only for a particular subset of warnings I think the severity should still be considered high as missing this warning along can (an has already) cost a lot of hours and frustration.
While the above (striked through) is true, we have lived with this a long time. So I think it is serious but nobody noticed this for a long time (it is indeed hard to spot) ...

Also this seems to be a regression as it worked previously.

@Lleutch Did some testing and says this has been introduced "between FCS 9.0.1 and FCS 10.0.3"

/cc @Krzysztof-Cieslak @vasily-kirichenko @Lleutch

Activity

  1. vasily-kirichenko commented on Oct 14, 2017

    @vasily-kirichenko
    Contributor

    I can reproduce it: no warnings for this specific function in latest VS 2017 and Rider: neither in the compiler output nor in the IDE. However, there is a warning for this simpler function:

    default

  2. vasily-kirichenko commented on Oct 14, 2017

    @vasily-kirichenko
    Contributor

    I can reproduce it on a ~10 months old revision (a7245c3), so it's not a very recent regression.

  3. Lleutch commented on Oct 14, 2017

    @Lleutch

    I am adding that repo here :
    https://github.com/Lleutch/VFT-3752

    It is regarding the different versions of FCS returning or not the expected warnings.

  4. added
    Impact-Medium
    and removed on Jan 29, 2018
  5. matthid commented on Mar 9, 2018

    @matthid
    ContributorAuthor

    @dsyme is it not considered a regression anymore?

  6. dsyme commented on Mar 10, 2018

    @dsyme
    Contributor

    Yes, this is a regression - or at least the warning should be shown. I don't know why I changed the label

  7. added a commit that references this issue on Mar 10, 2018
    cd4f230
  8. matthid commented on Mar 10, 2018

    @matthid
    ContributorAuthor

    So after fixing this it seems like the compiler has thrown all warnings away while doing overload resolution. This would explain @vasily-kirichenko's finding, and that other warnings might be missing as well.

  9. dsyme commented on Mar 12, 2018

    @dsyme
    Contributor

    @matthid Super, thanks for looking into this

  10. added a commit that references this issue on Mar 17, 2018
    178fc31
  11. added a commit that references this issue on Jun 12, 2026
    7384ceb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact-MediumRegression

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions