nim-lang / vscode-nim

A VS Code plugin for the Nim language
Other
75 stars 8 forks source link

Server fails with `RecoverableError` on code with generic closures #109

Closed ibb-dinosaur closed 2 days ago

ibb-dinosaur commented 2 days ago

Version: 1.2.0, Nim Compiler Version 2.0.8, Windows amd64

When a file including specific code with generics and closures is opened, the language server fails (upon restarting, it fails again) Minimal reproducible example I could get that fails:

import sugar

type
    Parser[T] = object

proc eatWhile[T](p: Parser[T], predicate: T -> bool): seq[T] =
    return @[]

proc skipWs(p: Parser[char]) =
    discard p.eatWhile((c: char) => c == 'a')

The code is valid Nim (it compiles), so it shouldn't crash the language server.

This is the error message produced by the language server:

Server failed with lineinfos.nim(318)     raise RecoverableError
Error: unhandled exception: fatal error: command expects a filename [ERecoverableError]
ibb-dinosaur commented 2 days ago

Sorry, just realised this should be in the nim-language-server repo, not here.