Skip to content

Add support for LibraryOnlyStaticOptimization #1769

Closed
@nojaf

Description

Issue created from fantomas-online

Code

            let FromZero () : 'T = 
                (get32 0 :?> 'T) when 'T : BigInteger = BigInteger.Zero 

Error

Fantomas.FormatConfig+FormatException: Unsupported construct(s) between line 3 column 17 and line 3 column 33
   at Fantomas.CodePrinter.genExpr(ASTContext astContext, SynExpr synExpr, Context ctx) in /workspace/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 2430
   at Fantomas.Context.shortExpressionWithFallback(FSharpFunc`2 shortExpression, FSharpFunc`2 fallbackExpression, Int32 maxWidth, FSharpOption`1 startColumn, Context ctx) in /workspace/.deps/fantomas/src/Fantomas/Context.fs:line 842
   at Fantomas.Context.op_PlusGreater(FSharpFunc`2 ctx, FSharpFunc`2 f, Context x) in /workspace/.deps/fantomas/src/Fantomas/Context.fs:line 489
   at Fantomas.Context.op_PlusGreater(FSharpFunc`2 ctx, FSharpFunc`2 f, Context x) in /workspace/.deps/fantomas/src/Fantomas/Context.fs:line 489
   at Fantomas.Context.col[T](FSharpFunc`2 f', IEnumerable`1 c, FSharpFunc`2 f, Context ctx) in /workspace/.deps/fantomas/src/Fantomas/Context.fs:line 576
   at Fantomas.CodePrinter.genImpFile@81-6.Invoke(Context ctx) in /workspace/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 81
   at Fantomas.Context.op_PlusGreater(FSharpFunc`2 ctx, FSharpFunc`2 f, Context x) in /workspace/.deps/fantomas/src/Fantomas/Context.fs:line 489
   at Fantomas.CodeFormatterImpl.formatWith(ParsedInput ast, FSharpList`1 defines, FSharpList`1 hashTokens, FormatContext formatContext, FormatConfig config) in /workspace/.deps/fantomas/src/Fantomas/CodeFormatterImpl.fs:line 391
   at Fantomas.CodeFormatterImpl.format@406-1.Invoke(Tuple`3[] _arg1) in /workspace/.deps/fantomas/src/Fantomas/CodeFormatterImpl.fs:line 408
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 404
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
--- End of stack trace from previous location ---
   at FantomasOnline.Server.Shared.Http.formatResponse@95-6.Invoke(Unit unitVar0) in /workspace/src/server/FantomasOnline.Shared/Http.fs:line 95
   at Ply.TplPrimitives.AwaitableContinuation`3.Invoke(Unit r)

Problem description

Investigate whether it is possible to add support for SynExpr.LibraryOnlyStaticOptimization.

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 06/05/2021 12:02:39 - c557f79

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?

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions