Skip to content

FS3886: This list expression contains a single tuple element. This warning is too trigger happy #20962

Description

@smoothdeveloper
let a =
  [
    1,"a"
  ]

Did you mean to use ';' instead of ',' to separate list elements?

The warning doesn't make sense when the list elements aren't of the same type.

I would like the warning to be given only if the elements are of the same type.

Activity

  1. added this to the Backlog milestone on Nov 10, 2026
  2. charlesroddie commented on Nov 10, 2026

    @charlesroddie
    Contributor

    I don't think this suggestion is consistent. If 1,"a" is valid as a tuple, then 1,1 is also valid, and anything valid should not be warned about.

    My guess is it's unlikely to be a decision (e.g. strongly held enough to put in the official style guide) that tuples in F# should be bracketed in cases like the above.

    That means this warning should always be removed.

    The wording of the warning also makes this clear: the answer could be "no I didn't" in which case there is nothing to fix.

    It's using guesswork about the intent of the writer of the code, but writers of code now are typically AIs and they do confuse commas and semicolons like we do.

  3. majocha commented on Nov 10, 2026

    @majocha
    Contributor

    I'd say the warning make sense only if this causes a type error upstream.

  4. T-Gro commented on Nov 10, 2026

    @T-Gro
    Member

    So how would one describe the ruleset?
    If FS3886 and no warning from {selection of upstream errors that could be produced by it}, opt out of FS3886 ?

  5. shayanhabibi commented on Nov 11, 2026

    @shayanhabibi

    I'm not the greatest fan of this warning. I understand the intent though.

    I understand the authors point too, the reason that the warning makes no sense if the types are disjoint is because the warnings 'fix' is an error.

    [1,1]/[1;1] is not an error
    [1,"1"] is not an error / [1; "1"] is an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions