Skip to content

Crash when trying to format indexed property with three arguments. #2971

@gubser

Description

@gubser

I tried to create an issue using fantomas-online but GitHub reported 'Your request URL is too long.'.

Here's the link using preview version: fantomas-online

Code

type MyArray3 () = 
    member _.Item
        with get (x: int, y: int, z: int) =
            ()
        and set (x: int, y: int, z: int) v =
            ()

Result

System.ArgumentException: The lists had different lengths.
list1 is 1 element shorter than list2 (Parameter 'list1')
   at Microsoft.FSharp.Core.DetailedExceptions.invalidArgDifferentListLength[?](String arg1, String arg2, Int32 diff) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 26
   at Microsoft.FSharp.Primitives.Basics.List.zipToFreshConsTail[a,b](FSharpList`1 cons, FSharpList`1 xs1, FSharpList`1 xs2) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 906
   at Microsoft.FSharp.Primitives.Basics.List.zip[T1,T2](FSharpList`1 xs1, FSharpList`1 xs2) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 923
   at Microsoft.FSharp.Collections.ListModule.Zip[T1,T2](FSharpList`1 list1, FSharpList`1 list2) in D:\a\_work\1\s\src\FSharp.Core\list.fs:line 598
   at Fantomas.Core.ASTTransformer.mkTuplePat(CreationAide creationAide, FSharpList`1 pats, FSharpList`1 commas, Range m) in /_//src/Fantomas.Core/ASTTransformer.fs:line 1625
   at Fantomas.Core.ASTTransformer.mkPat(CreationAide creationAide, SynPat p) in /_//src/Fantomas.Core/ASTTransformer.fs:line 1709
   at [email protected](SynPat p)
   at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 243
   at Microsoft.FSharp.Collections.ListModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 list) in D:\a\_work\1\s\src\FSharp.Core\list.fs:line 96
   at Fantomas.Core.ASTTransformer.mkPropertyGetSetBinding(CreationAide creationAide, FSharpOption`1 accessibility, SingleTextNode leadingKeyword, SynBinding binding) in /_//src/Fantomas.Core/ASTTransformer.fs:line 2683
   at Fantomas.Core.ASTTransformer.mkMemberDefn(CreationAide creationAide, SynMemberDefn md) in /_//src/Fantomas.Core/ASTTransformer.fs:line 2893
   at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 243
   at Fantomas.Core.ASTTransformer.mkTypeDefn(CreationAide creationAide, SynTypeDefn _arg13) in /_//src/Fantomas.Core/ASTTransformer.fs:line 2619
   at Fantomas.Core.ASTTransformer.mkModuleDecls(CreationAide creationAide, FSharpList`1 decls, FSharpFunc`2 finalContinuation) in /_//src/Fantomas.Core/ASTTransformer.fs:line 3052
   at Fantomas.Core.ASTTransformer.mkModuleOrNamespace(CreationAide creationAide, SynModuleOrNamespace mn) in /_//src/Fantomas.Core/ASTTransformer.fs:line 3136
   at [email protected](SynModuleOrNamespace mn)
   at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 243
   at Microsoft.FSharp.Collections.ListModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 list) in D:\a\_work\1\s\src\FSharp.Core\list.fs:line 96
   at Fantomas.Core.ASTTransformer.mkImplFile(CreationAide creationAide, ParsedImplFileInput _arg15, Range m) in /_//src/Fantomas.Core/ASTTransformer.fs:line 3146
   at Fantomas.Core.ASTTransformer.mkOak(FSharpOption`1 sourceText, ParsedInput ast) in /_//src/Fantomas.Core/ASTTransformer.fs:line 3571
   at Fantomas.Core.CodeFormatterImpl.formatAST(ParsedInput ast, FSharpOption`1 sourceText, FormatConfig config, FSharpOption`1 cursor) in /_//src/Fantomas.Core/CodeFormatterImpl.fs:line 66
   at [email protected](Unit unitVar) in /_//src/Fantomas.Core/CodeFormatterImpl.fs:line 89
   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

Fantomas fails to format indexed property with three variables. But it works with two variabels, see fantomas-online

Extra information
[ ] The formatted result breaks my code.
[ ] The formatted result gives compiler warnings.
[x] I or my company would be willing to help fix this.
[x] I would like a release if this problem is solved.

Metadata

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