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

Comment after let binding breaks downstream output #1284

Closed
2 of 3 tasks
deviousasti opened this issue Dec 14, 2020 · 3 comments · Fixed by #1285
Closed
2 of 3 tasks

Comment after let binding breaks downstream output #1284

deviousasti opened this issue Dec 14, 2020 · 3 comments · Fixed by #1285

Comments

@deviousasti
Copy link
Member

Issue created from fantomas-online

Code

let value = // TODO: some comment
    let v = 2 + 3
    v

let k = -1

Error

Fantomas was able to format the code but the result appears to be invalid F# code.
Please open an issue.

Formatted result:

let value = // TODO: some comment
    let v =2 + 3
    v

let k =-1

Problem description

isValidFSharpCode fails if there's a comment after a let binding which doesn't immediately return a value.

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas Master at 12/11/2020 14:28:39 - 5a66ce5

Default Fantomas configuration

@deviousasti
Copy link
Member Author

Likely related to #1276 and #1281

@nojaf
Copy link
Contributor

nojaf commented Dec 14, 2020

Hello Asti, many thanks for reporting this.
I'm afraid it is related to the refactoring in #1230.
As it immediately rang a bell, I've added a fix in #1285.
Nonetheless, I appreciate you ticking off the box I or my company would be willing to help fix this..
🚀

@deviousasti
Copy link
Member Author

That was amazing.

I'd just started on the case when you posted.
image

The tests are passing, so I'm closing it. Thank you very much.

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.

2 participants