fsprojects / fsprojects/FSharpLint

Hint "x = true ===> x" is triggered by simple object creation or optional arguments

Open
#423 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

Tool is reporting error (FL0065): Hints x = truemight be able to be refactored intox. for the simple object creation process or optional arguments

Repro steps

Optional argument:

  1. Http.AsyncRequest("someSite", silentHttpErrors = true) |> Async.RunSynchronously
  2. -> (FL0065): Hints - Error: x = truemight be able to be refactored intox. on the (48 - 48)

Object initialization:

  1. Given C# class:
public class MySimpleType
    {
        public int SimpleInt { get;set;}
        public bool SuperBoolProperty { get; set; }
        public string SimpleString { get;set;}
    }
  1. And initialize it in F#
let giveObject () =
    MySimpleType(
        SimpleInt = 12,
        SuperBoolProperty = true,
        SimpleString = "String")
  1. -> (FL0065): Hints - Error: x = truemight be able to be refactored intox. on the (20- 20)
Expected behavior

Should be no error

Actual behavior

Tool reports error

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

Reproduce FL0065 with the optional-argument and simple-object-initialization examples from the issue, then locate the rule that emits this diagnostic. Confirm that both cases no longer produce the warning while other intended x = true suggestions remain unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.