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

nimsuggest: crash when analyzing code with generic closures #24179

Closed
ibb-dinosaur opened this issue Sep 26, 2024 · 3 comments · Fixed by #24185
Closed

nimsuggest: crash when analyzing code with generic closures #24179

ibb-dinosaur opened this issue Sep 26, 2024 · 3 comments · Fixed by #24185

Comments

@ibb-dinosaur
Copy link

Description

Using the vscode-nim extension (version 1.2) with the language server (version 1.6), the nimsuggest extension crashes when analyzing specific Nim code. The code is valid and compiles without errors.

Minimal reproducible example:

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')

Nim Version

Nim Compiler Version 2.0.8 [Windows: amd64]
Compiled at 2024-07-03

Current Output

Server failed with lineinfos.nim(318)     raise RecoverableError
Error: unhandled exception: fatal error: command expects a filename [ERecoverableError]

Expected Output

No response

Known Workarounds

No response

Additional Information

No response

@metagn
Copy link
Collaborator

metagn commented Sep 26, 2024

Guessing this causes the same issue

import sugar

type Parser[T] = T -> bool

@ibb-dinosaur
Copy link
Author

Ok after looking into it I was actually wrong. It's something about the server being restarted (possibly the vscode extension issue).
Screenshot 2024-09-26 230147

When I click Restart under the single open file, everything's fine. But when I click Restart All nimsuggest the error appears, even on an empty file. Not sure if I should open a new issue for this?

@metagn
Copy link
Collaborator

metagn commented Sep 26, 2024

I was able to reproduce a crash from the code, it segfaults the compiler, so there is an issue unrelated to the server restarting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants