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

type definition in signature file wrapped with hash directives #1115

Closed
3 tasks
nojaf opened this issue Sep 7, 2020 · 2 comments · Fixed by #2025
Closed
3 tasks

type definition in signature file wrapped with hash directives #1115

nojaf opened this issue Sep 7, 2020 · 2 comments · Fixed by #2025

Comments

@nojaf
Copy link
Contributor

nojaf commented Sep 7, 2020

Issue created from fantomas-online

Code

namespace X

type UnresolvedAssemblyReference = UnresolvedAssemblyReference of string * AssemblyReference list

#if !NO_EXTENSIONTYPING
type ResolvedExtensionReference = ResolvedExtensionReference of string * AssemblyReference list * Tainted<ITypeProvider> list
#endif

Error

System.Exception: Fantomas is trying to format the input multiple times due to the detect of multiple defines.
There is a problem with merging all the code back togheter. Please raise an issue at https://github.com/fsprojects/fantomas/issues.
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1639.Invoke(String message) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\printf.fs:line 1639
   at Fantomas.String.merge(String a, String b) in /home/runner/work/fantomas-tools/fantomas-tools/.deps/fantomas/src/Fantomas/Utils.fs:line 63
   at Fantomas.CodeFormatterImpl.merged@421.Invoke(String a, String b) in /home/runner/work/fantomas-tools/fantomas-tools/.deps/fantomas/src/Fantomas/CodeFormatterImpl.fs:line 421
   at Microsoft.FSharp.Collections.ListModule.Fold[T,TState](FSharpFunc`2 folder, TState state, FSharpList`1 list) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\list.fs:line 222
   at Microsoft.FSharp.Collections.ListModule.Reduce[T](FSharpFunc`2 reduction, FSharpList`1 list) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\list.fs:line 234
   at Fantomas.CodeFormatterImpl.format@412-1.Invoke(Tuple`2[] _arg1) in /home/runner/work/fantomas-tools/fantomas-tools/.deps/fantomas/src/Fantomas/CodeFormatterImpl.fs:line 421
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 416
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 109

Problem description

Most likely a trivia problem regarding one of the hash directives.

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 09/05/2020 10:04:29 - 9fed8b8

Default Fantomas configuration

@nojaf
Copy link
Contributor Author

nojaf commented Sep 8, 2020

Regression compared to v4.0

@nojaf
Copy link
Contributor Author

nojaf commented Sep 8, 2020

The trivia bug here is not a regression, only occurs in signature files.

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