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

val mutable in signature loses 'mutable' #1954

Closed
2 of 3 tasks
dsyme opened this issue Nov 5, 2021 · 1 comment · Fixed by #1968
Closed
2 of 3 tasks

val mutable in signature loses 'mutable' #1954

dsyme opened this issue Nov 5, 2021 · 1 comment · Fixed by #1968
Labels
bug (soundness) good first issue Long hanging fruit: easy issue to get your feet wet! help wanted

Comments

@dsyme
Copy link
Contributor

dsyme commented Nov 5, 2021

Issue created from fantomas-online

Code

/// For extra diagnostics 
val mutable showParserStackOnParseError: bool

Result

/// For extra diagnostics
val showParserStackOnParseError: bool

Problem description

Please describe here the Fantomas problem you encountered.
Check out our Contribution Guidelines.

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 4.6 branch at 11/03/2021 17:27:28 - 10f599c

Default Fantomas configuration

Signature file

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

@nojaf
Copy link
Contributor

nojaf commented Nov 8, 2021

Hello, thank you for reporting this issue.
The mutable information is not captured in:

let (|Val|)
(SynValSig (ats,
(IdentOrKeyword (OpNameFullInPattern (s, _)) as ident),
SynValTyparDecls (typars, _),
t,
vi,
isInline,
_,
px,
ao,
_,
range))
=
(ats, px, ao, s, ident.idRange, t, vi, isInline, typars, range)

and then not printed in

and genVal astContext (Val (ats, px, ao, s, identRange, t, vi, isInline, tds, range)) =
let typeName = genTypeAndParam astContext s tds []
let (FunType namedArgs) = (t, vi)
let hasGenerics = Option.isSome tds
genPreXmlDoc px
+> genAttributes astContext ats
+> (!- "val "
+> onlyIf isInline (!- "inline ")
+> opt sepSpace ao genAccess
+> typeName
|> genTriviaFor Ident_ identRange)
+> ifElse hasGenerics sepColonWithSpacesFixed sepColon
+> ifElse
(List.isNotEmpty namedArgs)
(autoIndentAndNlnIfExpressionExceedsPageWidth (genTypeList astContext namedArgs))
(genConstraints astContext t vi)
|> genTriviaFor SynValSig_ range

Something like onlyIf isMutable (!- "mutable ") is missing.

This is a good first issue for newcomers to get their feet wet.

@nojaf nojaf added help wanted good first issue Long hanging fruit: easy issue to get your feet wet! labels Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (soundness) good first issue Long hanging fruit: easy issue to get your feet wet! help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants