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

Adding parentheses around expressions can lead to incorrect indentation #385

Closed
SteveGilham opened this issue Dec 15, 2018 · 1 comment
Closed

Comments

@SteveGilham
Copy link

SteveGilham commented Dec 15, 2018

Description

Fantomas 0.9.1 command line --indent 2 --pageWidth 90

before

      let line =
        XElement(X "line", XAttribute(X "number", s.Attribute(X "sl").Value),
                 XAttribute(X "hits", vx),
                 XAttribute(X "branch",
                            if bec = 0 then "false"
                            else "true"))

after

      let line = // line 167
        XElement(X "line", XAttribute(X "number", s.Attribute(X "sl").Value),
                 XAttribute(X "hits", vx),
                 XAttribute(X "branch", (
                            if bec = 0 then "false"
                            else "true")))

The extra parentheses around the if expression lead to

[whatever].fs(171,29): error FS0058: Possible incorrect indentation: this token is offside of context started at position (170:29). Try indenting this token further or using standard formatting conventions.	

Repro code

http://ratatosk.dynu.net/fantomas/#?code=AQ0GwUwF2MEsB2FgF4CwAoU3gA0CikAthAlABS7ABE8S1ANHgIJRQBOcARgK5QSUaCHkS4R2jYAGcAdKw7c+AqtSlhqAShkA1AIZgeEDQ0w4zZ3PM69+g6gAs4UKZIBuAD2OnzPlm2tKdlzsuggAxvaM3r4x5nAAZsBiYajAAAzAUPakNPH6UhDU0bElIBBgBTQchpoaQA&config=N4IgkgdgJgphAuBlADgQwMYwHIFcC2IAXAEwA0IACqgOYwDqAllPABZECcADORQE4wBnGLwBuMAKLQA8gDMAMgwgwiM1ABsh5RDDwN0AezX6IAQXiSoshUpXrNIFBhgAhGDP38Tvavjjwi8Lw4MFpomK7u-ADChsYBQSEOYTAmMvDCMXh4qPHBoU6p6bzaugZGELmJkLAIUhAAKrwAnoysthqJAEowHrC8UshwACIw6GqovKjwDHGEqh35mF76ONAjagy6RZVagXrwALL6sO1CAL5AA

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

No branches or pull requests

3 participants