Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Format Code removed essential parenthesis #366

Closed
matthid opened this issue Apr 21, 2014 · 2 comments
Closed

Format Code removed essential parenthesis #366

matthid opened this issue Apr 21, 2014 · 2 comments

Comments

@matthid
Copy link

matthid commented Apr 21, 2014

When you have code like:

type A =
    abstract member M : int -> (int -> unit)
    abstract member M : float -> int

the parenthesis around (int -> unit) are actually important, because after formatting you get

type A = 
    abstract M : int -> int -> unit
    abstract M : float -> int

Which results in a compiler error (FS0439). (In fact you first get weird compiler errors in the implementations). Can I somehow disable this as a workaround?

@dungpa dungpa added this to the 1.1.0 milestone May 3, 2014
@dungpa dungpa removed this from the 1.1.0 milestone May 19, 2014
@dungpa
Copy link
Contributor

dungpa commented Sep 12, 2015

@matthid My apologies for answering way too late (Well, it has been more than a year).

I did multiple tries to fix this bug in the past but failed. At one point, I believed that the AST lacked relevant information to preserve parentheses. I figured out a non-intrusive way to fix the bug today.

The bug has been fixed in fsprojects/fantomas#177 and the fix flows to VFPT at #1115.

@dungpa dungpa added this to the v2.1.0 milestone Sep 12, 2015
@matthid
Copy link
Author

matthid commented Sep 12, 2015

No need to be sorry. I'm glad this will be fixed now 👍
I remember this issue was one of the blockers for me to use "Format Code on Save" with F# (which is a good way to find such bugs apparently). So maybe with 2.1.0 its time to try again :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants