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

"attempt to index a nil value" error during type check #915

Closed
svermeulen opened this issue Jan 17, 2025 · 1 comment
Closed

"attempt to index a nil value" error during type check #915

svermeulen opened this issue Jan 17, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@svermeulen
Copy link
Contributor

When using branch generics-regressions from #911, and also using teal language server, I find the server crashes sometimes due to a nil reference exception happening deep in the guts of teal:

  │ Error in handler for request with method 'textDocument/didChange': 'tl.lua:6188: attempt to index a nil value
  │ stack traceback:
  │ 	tl.lua:6188: in function 'rollback_symbol_list_scope'
  │ 	tl.lua:8260: in function 'rollback_scope_transaction'
  │ 	tl.lua:9980: in function 'check_poly_call'
  │ 	tl.lua:10048: in function 'type_check_function_call'
  │ 	tl.lua:10129: in function 'check_metamethod'
  │ 	tl.lua:13136: in function 'cbkind_after'
  │ 	tl.lua:5104: in function 'recurse'
  │ 	tl.lua:4889: in function 'fn'
  │ 	tl.lua:5096: in function 'recurse'
  │ 	tl.lua:4900: in function 'fn'
  │ 	tl.lua:5096: in function 'recurse'
  │ 	...
  │ 	tl.lua:5096: in function 'recurse_node'
  │ 	tl.lua:13896: in function 'type_check'
  │ 	teal_language_server/document.lua:141: in function 'get_result'

I should note that I've made some very minor modifications to tl.lua (just adding a few globals) which puts the line numbers out of sync with the branch. In my version, tl.lua:6188 refers to line while symbol_list[symbol_list_n].name ~= "@{" do in function collector.rollback_symbol_list_scope = function()

I tried to find a small reproducible example outside of my codebase but wasn't successful on first attempt. I can try again though if the above isn't enough information.

@hishamhm hishamhm added the bug Something isn't working label Jan 17, 2025
@hishamhm
Copy link
Member

Ah, thanks! This shouldn't be hard to fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants