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

Support new Interface Static Methods syntax #2500

Closed
3 tasks
nojaf opened this issue Sep 13, 2022 · 2 comments
Closed
3 tasks

Support new Interface Static Methods syntax #2500

nojaf opened this issue Sep 13, 2022 · 2 comments

Comments

@nojaf
Copy link
Contributor

nojaf commented Sep 13, 2022

Issue created from fantomas-online

Code

module CheckNewSyntax

   // Check that "property" and "get_ method" constraints are considered logically equivalent
    let inline f_StaticProperty<'T when 'T : (static member StaticProperty: int) >() : int = 'T.StaticProperty

    let inline f_StaticMethod<'T when 'T : (static member StaticMethod: int -> int) >() : int = 'T.StaticMethod(3)

    let inline f_set_StaticProperty<'T when 'T : (static member StaticProperty: int with set) >() = 'T.set_StaticProperty(3)

    let inline f_InstanceMethod<'T when 'T : (member InstanceMethod: int -> int) >(x: 'T) : int = x.InstanceMethod(3)

    let inline f_Length<'T when 'T : (member Length: int) >(x: 'T) = x.Length

    let inline f_set_Length<'T when 'T : (member Length: int with set) >(x: 'T) = x.set_Length(3)

    let inline f_Item<'T when 'T : (member Item: int -> string with get) >(x: 'T) = x.get_Item(3)

Error

Fantomas.Core.FormatConfig+FormatException: Parsing failed with errors: [{ Severity = Error
   SubCategory = "parse"
   Range = Some tmp.fsx (4,93--4,94)
   ErrorNumber = Some 10
   Message = "Unexpected quote symbol in binding" };
 { Severity = Error
   SubCategory = "parse"
   Range = Some tmp.fsx (6,96--6,97)
   ErrorNumber = Some 10
   Message = "Unexpected quote symbol in binding" };
 { Severity = Error
   SubCategory = "parse"
   Range = Some tmp.fsx (8,100--8,101)
   ErrorNumber = Some 10
   Message = "Unexpected quote symbol in binding" }]
   at Fantomas.Core.CodeFormatterImpl.parse@28.Invoke(Unit unitVar) in /_//src/Fantomas.Core/CodeFormatterImpl.fs:line 33
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 447
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104

Problem description

The changes of dotnet/fsharp#13119 introduced some new syntax. Fantomas needs to be updated in order to deal with this properly.

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.

Options

Fantomas master branch at 2022-09-11T16:37:09Z - 7fb34e5

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 Author

nojaf commented Sep 18, 2022

This was somewhat addressed in #2510.

@nojaf
Copy link
Contributor Author

nojaf commented Dec 5, 2022

This is available in the 5.1 series.

@nojaf nojaf closed this as completed Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant