"Julia [IncorrectCallArgs]: Possible Method Call Error" in Emacs after Julia 1.10 Update

I’ve just updated to Julia 1.10 and have encountered an issue in Emacs (version 30) using eglot and eglot-jl. Specifically, I’m receiving flymake messages stating “Julia [IncorrectCallArgs]: Possible method call error” on several lines of my code, for example in all include expressions. This wasn’t an issue in previous versions of Julia, and I’m trying to figure out what might be causing it.

My Emacs configuration for Julia is as follows:

(use-package eglot-jl
  :straight t)

(use-package julia-ts-mode
  :straight t
  :mode "\\.jl$"
 :interpreter ("julia" . julia-mode)
 :init (setenv "JULIA_NUM_THREADS" "4")
 :config
 (add-hook 'julia-mode-hook 'eglot-jl-init)
 (add-hook 'julia-mode-hook 'eglot-ensure)
 (add-hook 'julia-mode-hook (lambda () (setq julia-repl-set-terminal-backend 'vterm)))
 (add-hook 'julia-mode-hook #'julia-formatter-mode))

;; Julia Formatter
(use-package julia-formatter
  :straight (julia-formatter :type git :host codeberg :repo "FelipeLema/julia-formatter.el"
                             :files ("julia-formatter.el"
                                     "toml-respects-json.el"
                                     "formatter_service.jl"
                                     "Manifest.toml" "Project.toml")))

(setq eglot-connect-timeout 1000)

I’m curious if anyone else has encountered similar issues after the Julia 1.10 update, especially when using Emacs. Any insights or suggestions on how to resolve or mitigate this issue would be greatly appreciated.

Thank you for your help and advice!

3 Likes

Could you post the full error message?

It is exactly what I wrote. Here is a snapshot.

Could the source of the problem be the new parser in Julia 1.10? I checked the eglot events log, and here is what I observed:

When running Julia 1.10, I get the following:

[jsonrpc] e[10:57:53.817] <-- textDocument/publishDiagnostics
{"method":"textDocument/publishDiagnostics","params":{"uri":"file:///scratch/ehsan/projects/COS/src/COS.jl","version":0,"diagnostics":
[
{"range":{"start":{"line":9,"character":0},"end":{"line":9,"character":25}},"severity":3,"code":"IncorrectCallArgs","source":"Julia","message":"Possible method call error."},
{"range":{"start":{"line":10,"character":0},"end":{"line":10,"character":25}},"severity":3,"code":"IncorrectCallArgs","source":"Julia","message":"Possible method call error."},
{"range":{"start":{"line":11,"character":0},"end":{"line":11,"character":26}},"severity":3,"code":"IncorrectCallArgs","source":"Julia","message":"Possible method call error."}
]},"jsonrpc":"2.0"}

Conversely, when running Julia 1.9.4, I receive:

[jsonrpc] e[10:56:32.048] <-- textDocument/publishDiagnostics 
{"method":"textDocument/publishDiagnostics","params":{"uri":"file:///scratch/ehsan/projects/COS/src/COS.jl","version":0,"diagnostics":[]},"jsonrpc":"2.0"}

In the case of Julia 1.10, the three messages correspond to three include calls in my file. After checking other files, it appears that these messages often occur when dealing with strings.

1 Like

It is the same for me. Actually I do not know if it happened with previous versions, but it is happen me with code as simple as:

a = "hola"
println(a)

It gives me in line 2:

Julia [IncorrectCallArgs]: Possible method call error.

I am using eglot and eglot-jl also, with a smaller configuration.

1 Like

Today I updated Julia packages in the eglot-jl folder, and the problem is resolved now.

3 Likes

I had the same problem, and going into the ~/.emacs.d/elpa/eglot-jl-20230601.1335 and running julia --project, and then ] update appears to have resolved the problem. I did also have to re-run eglot-jl-init.

1 Like

That is exactly what I did. It didn’t work right after v1.10 release, but after recent commits to SymbolServer.jl, the issue has been resolved.