You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeFoo={ Mem :unit -> unit }
static Empty: Foo ={ Mem =(fun x -> failwith "Unimplemented function")}
Error
Fantomas.Core.ParseException: ParseException
[{ Severity = Error
SubCategory ="parse"
Range = Some (4,4--4,10)
ErrorNumber = Some 3862
Message ="Incomplete declaration of a static construct. Use 'static let','static do','static member' or 'static val' for declaration."}]
at Fantomas.Core.CodeFormatterImpl.parse@24.Invoke(Unit unitVar)in/_//src/Fantomas.Core/CodeFormatterImpl.fs:line 29
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 508
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 112
Problem description
The F# compiler accepts this, at least as of net8:
> dotnet fsi
Microsoft (R) F# Interactive version 12.8.0.0 for F# 8.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> type Foo = { Bar : unit -> unit } with static Empty : Foo = { Bar = fun () -> () }
- ;;
type Foo =
{ Bar: (unit -> unit) }
static member Empty: Foo
Interestingly try.fsharp.org exhibits a similar failure, though.
(There's an obvious workaround, namely to add the keyword member.)
Extra information
The formatted result breaks my code.
The formatted result gives compiler warnings.
I or my company would be willing to help fix this.
I would like a release if this problem is solved.
Options
Fantomas main branch at 2023-12-29T14:09:11Z - a999b77
Default Fantomas configuration
Did you know that you can ignore files when formatting by using a .fantomasignore file? PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.
The text was updated successfully, but these errors were encountered:
I think this is related to dotnet/fsharp#16345
So the net8 F# compiler is behind our parser code and still accepts this but won't anymore with the next bugfix release.
Issue created from fantomas-online
Code
Error
Problem description
The F# compiler accepts this, at least as of net8:
Interestingly try.fsharp.org exhibits a similar failure, though.
(There's an obvious workaround, namely to add the keyword
member
.)Extra information
Options
Fantomas main branch at 2023-12-29T14:09:11Z - a999b77
Default Fantomas configuration
Did you know that you can ignore files when formatting by using a .fantomasignore file?
PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.
The text was updated successfully, but these errors were encountered: