Skip to content

missing parentheses in function type definition #1340

@TheAngryByrd

Description

@TheAngryByrd

Discussed in #1337

Originally posted by joprice January 8, 2025
I'm asking this here as I'm not sure where to open an issue and the issue templates are quite hefty. Other issues I've opened were premature and maybe a distraction to contributors, since they may have been issues in the underlying fsharp compiler libraries powering fsautocomplete. (It's also tricky to search for an existing issue across many repos, as this may be fixed already on head).

I've found that the type hint shown for certain types where a type is parameterized by a tuple and a function are not correctly printed with the correct precedence. For example, In the screenshot below, it shows a tupled function to 'c instead of a tuple of a value and a function from unit to `c.

This affects the Add explicit type annotation code action, which is where I usually notice it, since the provided type causes a compilation error in otherwise working unannotated code.

Screenshot 2025-01-08 at 7 28 13 PM

(In passing, another issue with the Add explicit type annotation I noticed is that it doesn't add the requires bounds, so the type ends up being just `c in this specific case when it's used on an untyped token, which is valid, but perhaps surprising given that the tooling shows a more specific type.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions