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

Unresolved import causes nls to panic #1935

Closed
mkatychev opened this issue Jun 1, 2024 · 5 comments
Closed

Unresolved import causes nls to panic #1935

mkatychev opened this issue Jun 1, 2024 · 5 comments

Comments

@mkatychev
Copy link
Contributor

Describe the bug

[ERROR] .../vim/lsp/rpc.lua:789	"rpc"	"~/.nix-profile/bin/nls"	"stderr"	"thread 'main' panicked at core/src/typecheck/mod.rs:2819:26:Internal error: resolved import not found during typechecking.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
"

To Reproduce
Declare an import in an ncl that has no resolution: let ObjectThatDoesNotExist = import "real_file.ncl in

Expected behavior
nls should be fault tolerant to an unresolved dependency tree and turn the panic below into an error or log for NLS:

let t = r
.get(*file_id)
.expect("Internal error: resolved import not found during typechecking.");

Environment

  • OS name + version: macOS 14.2.1 (23C71)
  • Version of the code: 1.6.0

Additional context
neovim default LSP

@yannham
Copy link
Member

yannham commented Jun 3, 2024

Hi, thanks for the report. The issue isn't that the import isn't resolved (which is usually entirely fine for the LSP and the typechecker, if it can't be found), but rather that the import has been resolved at some point but the corresponding source isn't in the source cache anymore.

I wonder how that could have happened, as besides a few exceptions (temporary holders for error messages) we never remove stuff from the source cache; have you done anything special, like having a valid import that you deleted at some point while NLS was active?

I just tried your example, both with the error (you're missing a closing ") and without, and adding stuff to make it a proper program, but I can't trigger the bug - I just get a proper "import not found" error.

image

Would you have a minimal, complete and reproducible example that triggers the bug for you, to help us address the issue?

@mkatychev
Copy link
Contributor Author

Hi @yannham I will try to produce an example

@yannham
Copy link
Member

yannham commented Jun 19, 2024

Hello @mkatychev, even without a small example, does this still happen on 1.7 ? We suspect #1944 might have solved the problem. Let us know!

@mkatychev
Copy link
Contributor Author

Thanks for the followup @yannham let me get to it tomorrow. The issue was a bit hard to reproduce but that ticket looks like the right steps to make it happen since I was heavily refactoring imported modules

@mkatychev
Copy link
Contributor Author

I'm not able to reproduce the issue w/ 1.7, thanks for the fix @jneem!

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

No branches or pull requests

2 participants