fsprojects / fsprojects/FSharpLint

FL0034: False positive with F# 5

Open
#469 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
327
Forks
74
PR merge metrics
No merged PRs in 30d

Description

Description

When installing F# 5, I have faced an error due to an overload resolution change and after fixing it, I keep getting the FL0034. See https://github.com/dotnet/fsharp/issues/10424

Repro steps

Before F# 5:

let frameDuration =
	getFrameRate model
	|> Option.defaultValue(10</s>)
	|> fun rate -> 1 / rate * 1000<ms/s>
	|> int
Cmd.batch [
	Cmd.ofMsg NextFrame
	Cmd.OfAsync.perform Async.Sleep frameDuration (fun () -> AutoPlayNextFrame)
]

With F# 5 (a new TimeSpan overload as been introduced)

let frameDuration =
	getFrameRate model
	|> Option.defaultValue(10</s>)
	|> fun rate -> 1 / rate * 1000<ms/s>
	|> int
Cmd.batch [
	Cmd.ofMsg NextFrame
	Cmd.OfAsync.perform (fun (x:int) -> Async.Sleep x) frameDuration (fun () -> AutoPlayNextFrame)
]
Expected behavior

No warning on the (fun (x:int) -> Async.Sleep x)

Actual behavior

Warning

Known workarounds

None, to my knowledge.

Related information
  • Operating system: Win10
  • net48, F# 5
  • VS2019 latest and VS2019 Preview

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the FL0034 rule and reproduce the supplied F# 5 example, including the Async.Sleep overload and the linked F# issue. Trace why the typed lambda is reported, then add or update coverage for this reproduction so the warning is absent when the behavior is fixed.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.