myriad icon indicating copy to clipboard operation
myriad copied to clipboard

Myriad throws errors when trying to process a file with new F# syntax

Open OrfeasZ opened this issue 1 year ago • 2 comments

I have a file that has a type that looks similar to this:

type MyType = {
  items: MyItem list
} with
  member self.itemIds = self.items |> List.map _.id

This uses the new _. shorthand syntax introduced in F# 8.

When trying to process this file, Myriad fails with the following error (and a bunch more after it):

OTHER: System.Exception: Error in Myriad.Plugins.LensesGenerator: LensesGenerator Failure
!CompilationError
Fantomas.Core.ParseException: ParseException
  [{ Severity = Error
     SubCategory = "parse"
     Range = Some (937,107--937,108)
     ErrorNumber = Some 10
     Message = "Unexpected symbol '_' in expression" };

Is this just a matter of updating the version of the F# compiler services & Fantomas used by Myriad? If so I'm happy to give it a go and submit a PR.

OrfeasZ avatar Oct 10 '24 00:10 OrfeasZ

I tried out updating fantomas and hit only one issue with CreateImplicitCtor where SynSimplePats switch to SynPat. I didn't have time to check what the right value should be, but after commenting it out, I was able to get it to run on code that uses the new placeholder function syntax https://github.com/MoiraeSoftware/myriad/compare/master...joprice:myriad:updateFantomas?expand=1#diff-bcdb0d0a4bdbc43b9b95e736fcaf924c2279e06b92feb05914291fd71db383ceR399

joprice avatar Oct 11 '24 22:10 joprice

Yeah the version of FCS and Fantomas needs to be incremented to one that has the new AST components. Any updating the calls inot Fantomas that they changed.

7sharp9 avatar Oct 12 '24 09:10 7sharp9