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

Indexer usage fails to parse #497

Closed
maxdeviant opened this issue Oct 3, 2019 · 0 comments · Fixed by #514
Closed

Indexer usage fails to parse #497

maxdeviant opened this issue Oct 3, 2019 · 0 comments · Fixed by #514

Comments

@maxdeviant
Copy link

Description

F# code that tries to use an indexer on an object fails to parse.

Here is the problematic line of code:

analysisKey.Headers.Item(key) <- value

I imagine this probably isn't a very common case 😅

Stack trace

Exception: Unexpected expression: NamedIndexedPropertySet
  (LongIdentWithDots
     ([analysisKey; Headers; Item],
      [tmp.fsx (15,19--15,20) IsSynthetic=false;
       tmp.fsx (15,27--15,28) IsSynthetic=false]),
   Paren
     (Ident key,tmp.fsx (15,32--15,33) IsSynthetic=false,
      Some tmp.fsx (15,36--15,37) IsSynthetic=false,
      tmp.fsx (15,32--15,37) IsSynthetic=false),Ident value,
   tmp.fsx (15,8--15,46) IsSynthetic=false) Stack Trace:    at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1637.Invoke(String message) in E:\A\_work\130\s\src\fsharp\FSharp.Core\printf.fs:line 1637
   at Fantomas.CodePrinter.genExpr(ASTContext astContext, SynExpr synExpr) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 1168
   at Fantomas.CodePrinter.noIndentBreakNln(ASTContext astContext, SynExpr e, Context ctx) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 494
   at Fantomas.CodePrinter.genExpr@886-150.Invoke(Context x) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 886
   at Fantomas.CodePrinter.genTrivia@2036-1.Invoke(Context x) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 2036
   at Fantomas.Context.autoNlnCheck[a](FSharpFunc`2 f, FSharpFunc`2 sep, Context ctx) in /build/.deps/fantomas/src/Fantomas/Context.fs:line 390
   at Fantomas.Context.autoNlnOrAddSep(FSharpFunc`2 f, FSharpFunc`2 sep, Context ctx) in /build/.deps/fantomas/src/Fantomas/Context.fs:line 413
   at Fantomas.CodePrinter.genExpr@1023-250.Invoke(Context x) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 1023
   at Fantomas.Context.atIndentLevel(Boolean alsoSetIndent, Int32 level, FSharpFunc`2 f, Context ctx) in /build/.deps/fantomas/src/Fantomas/Context.fs:line 164
   at Fantomas.CodePrinter.genExpr@1017-251.Invoke(Context ctx) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 1017
   at Fantomas.CodePrinter.genTrivia@2036-1.Invoke(Context x) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 2036
   at Fantomas.CodePrinter.genInfixApps@1223-14.Invoke(Context x) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 1223
   at Fantomas.Context.atIndentLevel(Boolean alsoSetIndent, Int32 level, FSharpFunc`2 f, Context ctx) in /build/.deps/fantomas/src/Fantomas/Context.fs:line 164
   at Fantomas.CodePrinter.genExpr@928-214.Invoke(Context ctx) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 928
   at Fantomas.CodePrinter.genTrivia@2036-1.Invoke(Context x) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 2036
   at Fantomas.Context.col[T](FSharpFunc`2 f', IEnumerable`1 c, FSharpFunc`2 f, Context ctx) in /build/.deps/fantomas/src/Fantomas/Context.fs:line 261
   at Fantomas.CodePrinter.genExpr@1068-303.Invoke(Context ctx) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 1068
   at Fantomas.Context.atIndentLevel(Boolean alsoSetIndent, Int32 level, FSharpFunc`2 f, Context ctx) in /build/.deps/fantomas/src/Fantomas/Context.fs:line 164
   at Fantomas.CodePrinter.genExpr@1068-305.Invoke(Context ctx) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 1068
   at Fantomas.CodePrinter.genTrivia@2036-1.Invoke(Context x) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 2036
   at Fantomas.Context.futureNlnCheckMem@392-1.Invoke(Tuple`2 tupledArg) in /build/.deps/fantomas/src/Fantomas/Context.fs:line 397
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Fantomas.Cache.memoizeBy@87.Invoke(a x) in /build/.deps/fantomas/src/Fantomas/Utils.fs:line 88
   at Fantomas.CodePrinter.genExprSepEqPrependType(ASTContext astContext, FSharpFunc`2 prefix, SynPat pat, SynExpr e, Context ctx) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 470
   at Fantomas.CodePrinter.genTrivia@2036-1.Invoke(Context x) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 2036
   at Fantomas.CodePrinter.genTrivia@2036-1.Invoke(Context x) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 2036
   at Fantomas.CodePrinter.genTrivia@2036-1.Invoke(Context x) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 2036
   at Fantomas.Context.col[T](FSharpFunc`2 f', IEnumerable`1 c, FSharpFunc`2 f, Context ctx) in /build/.deps/fantomas/src/Fantomas/Context.fs:line 261
   at Fantomas.CodePrinter.genImpFile@79-6.Invoke(Context ctx) in /build/.deps/fantomas/src/Fantomas/CodePrinter.fs:line 79
   at Fantomas.CodeFormatterImpl.formatWith(ParsedInput ast, FSharpList`1 defines, FormatContext formatContext, FormatConfig config) in /build/.deps/fantomas/src/Fantomas/CodeFormatterImpl.fs:line 390
   at Fantomas.CodeFormatterImpl.format@405-1.Invoke(Tuple`2[] _arg1) in /build/.deps/fantomas/src/Fantomas/CodeFormatterImpl.fs:line 407
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 416
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 109
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.FSharp.Control.AsyncResult`1.Commit() in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 349
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 870
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 890
   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 1153
   at Server.Result.attempt[a](FSharpFunc`2 f) in /build/src/Server/Server.fs:line 24

Repro code

Online repro

jindraivanek added a commit that referenced this issue Oct 16, 2019
…#514)

* try actions

* CI

* CI

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* trigger build

* CI

* Replace Travis badge with Github Actions badge

* Add NamedIndexedPropertySet, DotNamedIndexedPropertySet

* Revert Paket.Restore.targets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant