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

Fix false negative in DisposedBeforeAsyncRunAnalyzer #77

Merged
merged 5 commits into from
Feb 15, 2024
Merged

Conversation

dawedawe
Copy link
Contributor

fixes #75

@dawedawe dawedawe requested a review from nojaf February 15, 2024 09:46
CHANGELOG.md Show resolved Hide resolved
@@ -103,6 +103,9 @@ let collectUses (sourceText : ISourceText) (ast : ParsedInput) (checkFileResults
|| elseExpr |> Option.map hasAsyncOrTaskInBody |> Option.defaultValue false
| SynExpr.TryFinally (tryExpr = tryExpr) -> hasAsyncOrTaskInBody tryExpr
| SynExpr.TryWith (tryExpr = tryExpr) -> hasAsyncOrTaskInBody tryExpr
| SynExpr.Match (clauses = clauses) ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make a note that this whole thing isn't tail-recursive? Or that is at least my educated guess.

Should we include SynExpr.MatchBang here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I see, that's already covered because to use match! we would need to be in an async already like:

let blah = new DisposableThing ()
use blah = blah
async {
    match! async {return 1} with
    | _ -> async { return "hi" }
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but in theory we could have something like:

let meh = async {
  let blah = new DisposableThing ()
  use blah = blah
  return! async {
      match! async {return 1} with
      | _ -> async { return "hi" }
  }
}

Might not be relevant for now.

Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it!

@dawedawe dawedawe merged commit 6932c8d into main Feb 15, 2024
1 check passed
@dawedawe dawedawe deleted the fix_75 branch February 15, 2024 13:37
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

Successfully merging this pull request may close these issues.

Expansion of dispose-before-async-is-run
3 participants