question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unused binding warning isn't reported for recursive binding in a type

See original GitHub issue

Consider the following type declaration:

type T() =
    let rec f x = ()
    and g x = ()

    do g ()

Earlier FCS versions would report f as unused with --warnon:1182 flag present, but the current main doesn’t report it anymore.

@psfinaki Could it be somehow related to #13429?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
dsymecommented, Sep 8, 2022

Even just this is a repro:

type T() =
    let f _ = ()
1reaction
auduchinokcommented, Sep 13, 2022

Another difference is now FSharpSymbol produced for such a function returns different things:

  • mfv.DeclaringEntity returns the containing type, previously it didn’t
  • mfv.IsModuleValueOrMember is true (I think it has been false previously)
Read more comments on GitHub >

github_iconTop Results From Across the Web

In Ocaml, how do I avoid an unused variable warning if ...
Any binding that starts with _ won't be in scope and won't give you unused variable warnings. Share. Share a link to this...
Read more >
Unused value warning on a recursive value that is used #7429
produces an unused value warning for x if it is not used in the rest of the program. However, the binding to x...
Read more >
Warning or error should be raised when alternative ...
In the case of Issue #3831, the let binding itself is not even recursive, but the body calls a constructor, which then indirectly...
Read more >
4.8. Warnings and sanity-checking
Report any function definitions (and local bindings) which are unused. For top-level functions, the warning is only given if the binding is not...
Read more >
4.8. Warnings and sanity-checking
Report any function definitions (and local bindings) which are unused. For top-level functions, the warning is only given if the binding is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found