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

There's a space between the type of an array and the square brackets: 'int[]' becomes 'int []' #2192

Closed
3 tasks
reijerh opened this issue Apr 5, 2022 · 5 comments · Fixed by #2193
Closed
3 tasks

Comments

@reijerh
Copy link
Contributor

reijerh commented Apr 5, 2022

Issue created from fantomas-online

Code

let foo (bar: int[]) =
    failwith "foo"

Result

let foo (bar: int []) = failwith "foo"

Problem description

The square brackets of array types are separated from the type by a space. I've never seen this style in .NET land, the style guide says:

For F# arrays, use the syntactic name int[] or int array rather than array.

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 branch at 2022-04-04T14:08:13Z - e784cd6

Default Fantomas configuration

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 Apr 5, 2022

Hello, thank you for bringing this up.
It appears we are not following the style guide here.
Are you interested in addressing this?
A PR can be submitted against the get-back branch.

@reijerh
Copy link
Contributor Author

reijerh commented Apr 5, 2022

I'll have a go.

@nojaf
Copy link
Contributor

nojaf commented Apr 5, 2022

Great, a good starting point would be our Contribution Guidelines.

nojaf added a commit that referenced this issue May 6, 2022
* Add release notes for 5.0.0-alpha-002

* Don't add space between type of array and square brackets (#2192) (#2193)

* Initial version of Fantomas FCS.

* WIP custom token lexer analysis.

* Capture each string variant differently in TriviaBuilderState.

* Convert non trivia byte string from AST.

* Detect verbatim string from AST in TStaticConstant.

* Grab string content from sourceText.

* Initial define processing.

* Determine when the tokens are dead code.

* Update getDefines in TokenParserTests.fs

* Don't preserve blank lines in dead code. Fix remaining unit tests.

* Restored relevant token parser tests.

* Reactivate TriviaTests.

* Construct token list once.

* Make local build work again.

* Add Fantomas 5 changes outline.

* Remove old commented code from TokenParser.fs.

* Reference F# compiler via Paket.

* Ignore format selection test.

* Add Fantomas.FCS library to Fantomas nuget package.

* Remove PrivateAssets for Fantomas.FCS

* Add Tailcalls true to Fantomas.FCS

* Add Tailcalls true to Fantomas.FCS

* Always restore certain nodes from sourceText.

* Process conditional hash directives using ConditionalDirectiveTrivia from AST.

* No tokens, no cry

* Update dotnet/fsharp to 08992b326c5332396b0e7cec0896c8fdbbdc1e17

* Refactor renaming of SynModuleDecl.DoExpr to SynModuleDecl.Expr.

* Restore triple slash comment at invalid location

* Update to LongIdentWithTrivia PR.

* Update trailing dot workaround.

* Process initial changes of LongIdentWithTrivia.

* Update FCS to a62af8f874b1fc289cf0a85998b55f598f85de9e to deal with active patterns without parameters.

* Process changes of SynPat.Named with SynIdent.

* Add backticks to ident if they were originally there.

* Update FCS to corrected SynLongIdent trivia.

* Make dot insertion a bit more flexible.

* Update to fix of prefix operator notation.

* Verify IsPrefixOperator based on decompiled notation.

* Correct SynPat.Record field names.

* Correct SynMeasure expr.

* Correct SynExpr.DotSet.

* Preserve backticks if they were there but don't bother adding them if deemed necessary.

* Deal with space before star operator in specific places.

* Modify existing bad part of unit test.

* Update remaining tests.

* Rename TriviaMainNodes to TriviaNodes.

* Un ignore passing tests.

* Update FCS to dotnet/fsharp with SynLongIdent.

* Update FAKE build.

* Rename TokenParser to Defines.

* Remove TriviaContext.fs

* Remove ident trivia content.

* Remove Lex api.

* Update documentation to latest details.

* Add limitation for trivia between triple slash comment and module.

* Revert documentation subtitle.

* Update FCS to "Add trivia for SynModuleOrNamespace".

* Process changes of SynModuleOrNamespaceTrivia.

* Update to FCS SynValSigTrivia.

* Use val keyword from SynValSigTrivia.

Co-authored-by: reijerh <reijerh@users.noreply.github.com>
nojaf added a commit that referenced this issue May 6, 2022
* Add release notes for 5.0.0-alpha-002

* Don't add space between type of array and square brackets (#2192) (#2193)

* Initial version of Fantomas FCS.

* WIP custom token lexer analysis.

* Capture each string variant differently in TriviaBuilderState.

* Convert non trivia byte string from AST.

* Detect verbatim string from AST in TStaticConstant.

* Grab string content from sourceText.

* Initial define processing.

* Determine when the tokens are dead code.

* Update getDefines in TokenParserTests.fs

* Don't preserve blank lines in dead code. Fix remaining unit tests.

* Restored relevant token parser tests.

* Reactivate TriviaTests.

* Construct token list once.

* Make local build work again.

* Add Fantomas 5 changes outline.

* Remove old commented code from TokenParser.fs.

* Reference F# compiler via Paket.

* Ignore format selection test.

* Add Fantomas.FCS library to Fantomas nuget package.

* Remove PrivateAssets for Fantomas.FCS

* Add Tailcalls true to Fantomas.FCS

* Add Tailcalls true to Fantomas.FCS

* Always restore certain nodes from sourceText.

* Process conditional hash directives using ConditionalDirectiveTrivia from AST.

* No tokens, no cry

* Update dotnet/fsharp to 08992b326c5332396b0e7cec0896c8fdbbdc1e17

* Refactor renaming of SynModuleDecl.DoExpr to SynModuleDecl.Expr.

* Restore triple slash comment at invalid location

* Update to LongIdentWithTrivia PR.

* Update trailing dot workaround.

* Process initial changes of LongIdentWithTrivia.

* Update FCS to a62af8f874b1fc289cf0a85998b55f598f85de9e to deal with active patterns without parameters.

* Process changes of SynPat.Named with SynIdent.

* Add backticks to ident if they were originally there.

* Update FCS to corrected SynLongIdent trivia.

* Make dot insertion a bit more flexible.

* Update to fix of prefix operator notation.

* Verify IsPrefixOperator based on decompiled notation.

* Correct SynPat.Record field names.

* Correct SynMeasure expr.

* Correct SynExpr.DotSet.

* Preserve backticks if they were there but don't bother adding them if deemed necessary.

* Deal with space before star operator in specific places.

* Modify existing bad part of unit test.

* Update remaining tests.

* Rename TriviaMainNodes to TriviaNodes.

* Un ignore passing tests.

* Update FCS to dotnet/fsharp with SynLongIdent.

* Update FAKE build.

* Rename TokenParser to Defines.

* Remove TriviaContext.fs

* Remove ident trivia content.

* Remove Lex api.

* Update documentation to latest details.

* Add limitation for trivia between triple slash comment and module.

* Revert documentation subtitle.

* Update FCS to "Add trivia for SynModuleOrNamespace".

* Process changes of SynModuleOrNamespaceTrivia.

* Update to FCS SynValSigTrivia.

* Use val keyword from SynValSigTrivia.

Co-authored-by: reijerh <reijerh@users.noreply.github.com>
nojaf added a commit that referenced this issue May 6, 2022
* Initial settings for strousrup bracket style (#2161)

* Bare minimal changes for one test case.

* Initial draft of ragnarok feature.

* Add more syntax node where the case occurs.

* Maybe multiline strings?

* Highlight additional cases in SynBinding.

* Add new setting for ragnarok mode.
Take anonymous records in SynBinding into account.

* Separate test case into multiple files. Implement SynBindingFunction and Expressions.

* Add support for computation expressions.

* Add support for Array/List in SynBinding value/function.

* Exclude update records.

* Synbinding function with return type.

* Add additional tests for type members.

* Add LetOrUseBang with Expression.

* Add YieldOrReturn with Expression.

* Add YieldOrReturnBang with Expression.

* Add SynExprAndBang with Expression.

* Format test files.

* Add tests suffix

* Add LongIdentSetExpression with Expression.

* Add DotIndexedSet with Expression.

* Add Set with Expression.

* Add DotSet with Expression.

* Add Lambda with Expression.

* Add SynMatchClause with Expression.

* Add SynTypeDefnSimpleRepr.Record NOTE: TESTS FAIL

* Add SynTypeDefnSigRepr.Simple

* Use correct helper function for Set and DotSet.

* Work around edge case where match clause body needs to be further indented.

* Add named arguments in application and new expressions.

* Fix leftover issue

* Add TODO comment

* Fix failing test

* Format files

Co-authored-by: nojaf <florian.verdonck@outlook.com>

* Add changelog entry for first alpha of v5 (#2162)

* Update TargetFramework of .NET tool to net6.0 (#2184)

* Initial settings for strousrup bracket style (#2161)

* Bare minimal changes for one test case.

* Initial draft of ragnarok feature.

* Add more syntax node where the case occurs.

* Maybe multiline strings?

* Highlight additional cases in SynBinding.

* Add new setting for ragnarok mode.
Take anonymous records in SynBinding into account.

* Separate test case into multiple files. Implement SynBindingFunction and Expressions.

* Add support for computation expressions.

* Add support for Array/List in SynBinding value/function.

* Exclude update records.

* Synbinding function with return type.

* Add additional tests for type members.

* Add LetOrUseBang with Expression.

* Add YieldOrReturn with Expression.

* Add YieldOrReturnBang with Expression.

* Add SynExprAndBang with Expression.

* Format test files.

* Add tests suffix

* Add LongIdentSetExpression with Expression.

* Add DotIndexedSet with Expression.

* Add Set with Expression.

* Add DotSet with Expression.

* Add Lambda with Expression.

* Add SynMatchClause with Expression.

* Add SynTypeDefnSimpleRepr.Record NOTE: TESTS FAIL

* Add SynTypeDefnSigRepr.Simple

* Use correct helper function for Set and DotSet.

* Work around edge case where match clause body needs to be further indented.

* Add named arguments in application and new expressions.

* Fix leftover issue

* Add TODO comment

* Fix failing test

* Format files

Co-authored-by: nojaf <florian.verdonck@outlook.com>

* Add changelog entry for first alpha of v5 (#2162)

* - Update TargetFramework of .NET tool to net6.0
- Adjust path in TestHelpers.fs

* Add CHANGELOG.md entry

* move changelog entry to Unreleased section

* Fix CHANGELOG.md

Co-authored-by: Josh DeGraw <18509575+josh-degraw@users.noreply.github.com>
Co-authored-by: nojaf <florian.verdonck@outlook.com>

* Add release notes for 5.0.0-alpha-002

* Don't add space between type of array and square brackets (#2192) (#2193)

* Add framework restriction for group tool. (#2194)

* Embedded fcs (#2218)

* Add release notes for 5.0.0-alpha-002

* Don't add space between type of array and square brackets (#2192) (#2193)

* Initial version of Fantomas FCS.

* WIP custom token lexer analysis.

* Capture each string variant differently in TriviaBuilderState.

* Convert non trivia byte string from AST.

* Detect verbatim string from AST in TStaticConstant.

* Grab string content from sourceText.

* Initial define processing.

* Determine when the tokens are dead code.

* Update getDefines in TokenParserTests.fs

* Don't preserve blank lines in dead code. Fix remaining unit tests.

* Restored relevant token parser tests.

* Reactivate TriviaTests.

* Construct token list once.

* Make local build work again.

* Add Fantomas 5 changes outline.

* Remove old commented code from TokenParser.fs.

* Reference F# compiler via Paket.

* Ignore format selection test.

* Add Fantomas.FCS library to Fantomas nuget package.

* Remove PrivateAssets for Fantomas.FCS

* Add Tailcalls true to Fantomas.FCS

* Add Tailcalls true to Fantomas.FCS

* Always restore certain nodes from sourceText.

* Process conditional hash directives using ConditionalDirectiveTrivia from AST.

* No tokens, no cry

* Update dotnet/fsharp to 08992b326c5332396b0e7cec0896c8fdbbdc1e17

* Refactor renaming of SynModuleDecl.DoExpr to SynModuleDecl.Expr.

* Restore triple slash comment at invalid location

* Update to LongIdentWithTrivia PR.

* Update trailing dot workaround.

* Process initial changes of LongIdentWithTrivia.

* Update FCS to a62af8f874b1fc289cf0a85998b55f598f85de9e to deal with active patterns without parameters.

* Process changes of SynPat.Named with SynIdent.

* Add backticks to ident if they were originally there.

* Update FCS to corrected SynLongIdent trivia.

* Make dot insertion a bit more flexible.

* Update to fix of prefix operator notation.

* Verify IsPrefixOperator based on decompiled notation.

* Correct SynPat.Record field names.

* Correct SynMeasure expr.

* Correct SynExpr.DotSet.

* Preserve backticks if they were there but don't bother adding them if deemed necessary.

* Deal with space before star operator in specific places.

* Modify existing bad part of unit test.

* Update remaining tests.

* Rename TriviaMainNodes to TriviaNodes.

* Un ignore passing tests.

* Update FCS to dotnet/fsharp with SynLongIdent.

* Update FAKE build.

* Rename TokenParser to Defines.

* Remove TriviaContext.fs

* Remove ident trivia content.

* Remove Lex api.

* Update documentation to latest details.

* Add limitation for trivia between triple slash comment and module.

* Revert documentation subtitle.

* Update FCS to "Add trivia for SynModuleOrNamespace".

* Process changes of SynModuleOrNamespaceTrivia.

* Update to FCS SynValSigTrivia.

* Use val keyword from SynValSigTrivia.

Co-authored-by: reijerh <reijerh@users.noreply.github.com>

* Remove duplicate changelog entries.

Co-authored-by: Josh DeGraw <18509575+josh-degraw@users.noreply.github.com>
Co-authored-by: dawe <dawedawe@posteo.de>
Co-authored-by: reijerh <reijerh@users.noreply.github.com>
nojaf added a commit that referenced this issue May 6, 2022
* Add release notes for 5.0.0-alpha-002

* Don't add space between type of array and square brackets (#2192) (#2193)

* Initial version of Fantomas FCS.

* WIP custom token lexer analysis.

* Capture each string variant differently in TriviaBuilderState.

* Convert non trivia byte string from AST.

* Detect verbatim string from AST in TStaticConstant.

* Grab string content from sourceText.

* Initial define processing.

* Determine when the tokens are dead code.

* Update getDefines in TokenParserTests.fs

* Don't preserve blank lines in dead code. Fix remaining unit tests.

* Restored relevant token parser tests.

* Reactivate TriviaTests.

* Construct token list once.

* Make local build work again.

* Add Fantomas 5 changes outline.

* Remove old commented code from TokenParser.fs.

* Reference F# compiler via Paket.

* Ignore format selection test.

* Add Fantomas.FCS library to Fantomas nuget package.

* Remove PrivateAssets for Fantomas.FCS

* Add Tailcalls true to Fantomas.FCS

* Add Tailcalls true to Fantomas.FCS

* Always restore certain nodes from sourceText.

* Process conditional hash directives using ConditionalDirectiveTrivia from AST.

* No tokens, no cry

* Update dotnet/fsharp to 08992b326c5332396b0e7cec0896c8fdbbdc1e17

* Refactor renaming of SynModuleDecl.DoExpr to SynModuleDecl.Expr.

* Restore triple slash comment at invalid location

* Update to LongIdentWithTrivia PR.

* Update trailing dot workaround.

* Process initial changes of LongIdentWithTrivia.

* Update FCS to a62af8f874b1fc289cf0a85998b55f598f85de9e to deal with active patterns without parameters.

* Process changes of SynPat.Named with SynIdent.

* Add backticks to ident if they were originally there.

* Update FCS to corrected SynLongIdent trivia.

* Make dot insertion a bit more flexible.

* Update to fix of prefix operator notation.

* Verify IsPrefixOperator based on decompiled notation.

* Correct SynPat.Record field names.

* Correct SynMeasure expr.

* Correct SynExpr.DotSet.

* Preserve backticks if they were there but don't bother adding them if deemed necessary.

* Deal with space before star operator in specific places.

* Modify existing bad part of unit test.

* Update remaining tests.

* Rename TriviaMainNodes to TriviaNodes.

* Un ignore passing tests.

* Update FCS to dotnet/fsharp with SynLongIdent.

* Update FAKE build.

* Rename TokenParser to Defines.

* Remove TriviaContext.fs

* Remove ident trivia content.

* Remove Lex api.

* Update documentation to latest details.

* Add limitation for trivia between triple slash comment and module.

* Revert documentation subtitle.

* Update FCS to "Add trivia for SynModuleOrNamespace".

* Process changes of SynModuleOrNamespaceTrivia.

* Update to FCS SynValSigTrivia.

* Use val keyword from SynValSigTrivia.

Co-authored-by: reijerh <reijerh@users.noreply.github.com>
@dsyme
Copy link
Contributor

dsyme commented May 6, 2022

Looks like this can be closed? Was addressed in #2193? :)

@nojaf
Copy link
Contributor

nojaf commented May 7, 2022

Yes, this wasn't automatically closed because that PR wasn't targeting the master branch.

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

Successfully merging a pull request may close this issue.

3 participants