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

Unexpected identifier in lambda expression when using pre processor directives #1484

Closed
3 tasks
theimowski opened this issue Feb 26, 2021 · 1 comment · Fixed by #1592
Closed
3 tasks

Unexpected identifier in lambda expression when using pre processor directives #1484

theimowski opened this issue Feb 26, 2021 · 1 comment · Fixed by #1592

Comments

@theimowski
Copy link
Member

Issue created from fantomas-online

Code

let a = (fun _ -> function
    | A ->
        ()
#if DEBUG
        f()
#endif
    | B ->
        ()
)

Error

Fantomas.FormatConfig+FormatException: Parsing failed with errors: [|tmp.fsx (6,9)-(6,10) parse error Unexpected identifier in lambda expression. Expected incomplete structured construct at or before this point or other token.|]
And options: { SourceFiles = [|"tmp.fsx"|]
  ConditionalCompilationDefines = ["DEBUG"]
  ErrorSeverityOptions = { WarnLevel = 3
                           GlobalWarnAsError = false
                           WarnOff = []
                           WarnOn = []
                           WarnAsError = []
                           WarnAsWarn = [] }
  IsInteractive = false
  LightSyntax = None
  CompilingFsLib = false
  IsExe = false }
   at Fantomas.CodeFormatterImpl.parse@76-2.Invoke(FSharpParseFileResults _arg2) in /home/runner/work/fantomas-tools/fantomas-tools/.deps/fantomas/src/Fantomas/CodeFormatterImpl.fs:line 82
   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 <StartupCode$FSharp-Compiler-Service>.$Service.ParseFile@457-3.Invoke(AsyncActivation`1 ctxt) in D:\workspace\_work\1\s\src\fsharp\service\service.fs:line 457
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104

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 Master at 02/26/2021 10:32:56 - 6464684

    { config with
                IndentSize = 2 }

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 Feb 26, 2021

Thank you for reporting!

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.

2 participants