Fix crash during strict typechecking#766
Merged
castwide merged 1 commit intocastwide:masterfrom Mar 8, 2025
Merged
Conversation
Nil is dereferenced when typechecking this line in the Solargraph codebase at the :strict level: ``` loader.add library: library, version: nil ``` A function is looking at the wrong signature while analyzing code, leading to the arguments being passed to the typechecking function not being consistent. Exception: ``` /Users/broz/src/solargraph/lib/solargraph/type_checker.rb:368:in `kwarg_problems_for': undefined method `name' for nil:NilClass (NoMethodError) from /Users/broz/src/solargraph/lib/solargraph/type_checker.rb:332:in `block (2 levels) in argument_problems_for' from /Users/broz/src/solargraph/lib/solargraph/type_checker.rb:319:in `each' from /Users/broz/src/solargraph/lib/solargraph/type_checker.rb:319:in `each_with_index' from /Users/broz/src/solargraph/lib/solargraph/type_checker.rb:319:in `block in argument_problems_for' from /Users/broz/src/solargraph/lib/solargraph/type_checker.rb:314:in `each' from /Users/broz/src/solargraph/lib/solargraph/type_checker.rb:314:in `argument_problems_for' from /Users/broz/src/solargraph/lib/solargraph/type_checker.rb:278:in `block in call_problems' from /Users/broz/src/solargraph/lib/solargraph/type_checker.rb:251:in `each' from /Users/broz/src/solargraph/lib/solargraph/type_checker.rb:251:in `call_problems' from /Users/broz/src/solargraph/lib/solargraph/type_checker.rb:47:in `problems' from /Users/broz/src/solargraph/lib/solargraph/shell.rb:155:in `block in typecheck' from /Users/broz/src/solargraph/lib/solargraph/shell.rb:153:in `each' from /Users/broz/src/solargraph/lib/solargraph/shell.rb:153:in `typecheck' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/thor-1.3.2/lib/thor/command.rb:28:in `run' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/thor-1.3.2/lib/thor/base.rb:584:in `start' from /Users/broz/src/solargraph/bin/solargraph:5:in `<top (required)>' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/bin/solargraph:25:in `load' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/bin/solargraph:25:in `<top (required)>' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/lib/bundler/cli/exec.rb:58:in `load' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/lib/bundler/cli/exec.rb:58:in `kernel_load' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/lib/bundler/cli/exec.rb:23:in `run' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/lib/bundler/cli.rb:451:in `exec' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/lib/bundler/cli.rb:34:in `dispatch' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/lib/bundler/cli.rb:28:in `start' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/exe/bundle:28:in `block in <top (required)>' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors' from /Users/broz/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/bundler-2.5.4/exe/bundle:20:in `<top (required)>' from /Users/broz/.rbenv/versions/3.0.6/bin/bundle:25:in `load' from /Users/broz/.rbenv/versions/3.0.6/bin/bundle:25:in `<main>' ```
Owner
|
👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nil is dereferenced when typechecking this line in the Solargraph codebase at the :strict level:
A function is looking at the wrong signature while analyzing code, leading to the arguments being passed to the typechecking function not being consistent.
Exception: