Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpaceBeforeUppercaseInvocation applied in the middle of a invocation chain #853

Closed
Bobface opened this issue May 21, 2020 · 5 comments · Fixed by #962
Closed

SpaceBeforeUppercaseInvocation applied in the middle of a invocation chain #853

Bobface opened this issue May 21, 2020 · 5 comments · Fixed by #962

Comments

@Bobface
Copy link
Contributor

Bobface commented May 21, 2020

Issue created from fantomas-online

Notice the space between a.Some.Thing and ("aaa").[0]. That space makes it a different expression, namely ("aaa").[0] is interpreted as parameter to a.Some.Thing.

Code

module SomeModule =
    let DoSomething (a:SomeType) =
        let someValue = a.Some.Thing("aaa").[0]
        someValue

Result

module SomeModule =
    let DoSomething (a: SomeType) =
        let someValue = a.Some.Thing ("aaa").[0]
        someValue

Options

Fantomas Next - 4.0.0-alpha-001-1/1/1990

Name Value
IndentSpaceNum 4
PageWidth 120
SemicolonAtEndOfLine false
SpaceBeforeParameter true
SpaceBeforeLowercaseInvocation true
SpaceBeforeUppercaseInvocation true
SpaceBeforeClassConstructor false
SpaceBeforeMember false
SpaceBeforeColon false
SpaceAfterComma true
SpaceBeforeSemicolon false
SpaceAfterSemicolon true
IndentOnTryWith false
SpaceAroundDelimiter true
MaxIfThenElseShortWidth 40
MaxInfixOperatorExpression 50
MaxRecordWidth 40
MaxArrayOrListWidth 40
MaxLetBindingWidth 40
MultilineBlockBracketsOnSameColumn false
NewlineBetweenTypeDefinitionAndMembers false
KeepIfThenInSameLine false
StrictMode false
@knocte
Copy link
Contributor

knocte commented May 21, 2020

@Bobface not sure I understand; this leads to a compiler error or...?

@Bobface
Copy link
Contributor Author

Bobface commented May 21, 2020

@knocte Yes. The original is interpreted as (with extra parenthesis):

let someValue = (a.Some.Thing("aaa")).[0]

The formatted is interpreted as (with extra parenthesis):

let someValue = (a.Some.Thing)(("aaa").[0])

@Bobface
Copy link
Contributor Author

Bobface commented May 21, 2020

Note: Knocte and I have agreed to fix this on our side by applying parenthesis like this:

let someValue = (a.Some.Thing "aaa").[0]

@Bobface Bobface closed this as completed May 21, 2020
@knocte
Copy link
Contributor

knocte commented May 21, 2020

Yes, otherwise fixing this would break the purpose of SpaceBeforeUppercaseInvocation setting.

knocte pushed a commit to nblockchain/geewallet that referenced this issue May 21, 2020
ElectrumServer.fs had ambiguous parens around the parameters of a function call.
The positioning of the parens has been changed according to the style guide.
If we didn't apply the parens like in this commit, fantomas would cause a
compilation error when trying to format our codebase using our style settings.
(See fsprojects/fantomas#853 for more info.)
@nojaf
Copy link
Contributor

nojaf commented May 21, 2020

I feel like we should still fix this at Fantomas side as well.
Take this example.

We don't add the space in the first line to indeed not break the code.
This feels like a variant of that.

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

Successfully merging a pull request may close this issue.

3 participants