ruby-lsp 0.23.14 → 0.23.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/exe/ruby-lsp-launcher +9 -1
  4. data/lib/ruby_indexer/lib/ruby_indexer/configuration.rb +1 -1
  5. data/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb +6 -3
  6. data/lib/ruby_indexer/lib/ruby_indexer/entry.rb +4 -2
  7. data/lib/ruby_indexer/lib/ruby_indexer/index.rb +59 -29
  8. data/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb +5 -4
  9. data/lib/ruby_indexer/lib/ruby_indexer/reference_finder.rb +5 -1
  10. data/lib/ruby_indexer/test/class_variables_test.rb +14 -14
  11. data/lib/ruby_indexer/test/classes_and_modules_test.rb +65 -40
  12. data/lib/ruby_indexer/test/configuration_test.rb +6 -4
  13. data/lib/ruby_indexer/test/constant_test.rb +34 -34
  14. data/lib/ruby_indexer/test/enhancements_test.rb +1 -1
  15. data/lib/ruby_indexer/test/index_test.rb +139 -135
  16. data/lib/ruby_indexer/test/instance_variables_test.rb +37 -37
  17. data/lib/ruby_indexer/test/method_test.rb +118 -118
  18. data/lib/ruby_indexer/test/prefix_tree_test.rb +13 -13
  19. data/lib/ruby_indexer/test/rbs_indexer_test.rb +64 -70
  20. data/lib/ruby_indexer/test/test_case.rb +2 -2
  21. data/lib/ruby_lsp/erb_document.rb +12 -4
  22. data/lib/ruby_lsp/global_state.rb +1 -1
  23. data/lib/ruby_lsp/listeners/code_lens.rb +3 -3
  24. data/lib/ruby_lsp/listeners/completion.rb +24 -11
  25. data/lib/ruby_lsp/listeners/definition.rb +1 -1
  26. data/lib/ruby_lsp/listeners/document_link.rb +3 -1
  27. data/lib/ruby_lsp/listeners/document_symbol.rb +3 -3
  28. data/lib/ruby_lsp/listeners/folding_ranges.rb +8 -4
  29. data/lib/ruby_lsp/listeners/hover.rb +2 -2
  30. data/lib/ruby_lsp/listeners/semantic_highlighting.rb +12 -5
  31. data/lib/ruby_lsp/listeners/signature_help.rb +5 -1
  32. data/lib/ruby_lsp/listeners/spec_style.rb +1 -1
  33. data/lib/ruby_lsp/listeners/test_style.rb +3 -3
  34. data/lib/ruby_lsp/requests/code_action_resolve.rb +4 -3
  35. data/lib/ruby_lsp/requests/completion_resolve.rb +1 -1
  36. data/lib/ruby_lsp/requests/hover.rb +2 -2
  37. data/lib/ruby_lsp/requests/on_type_formatting.rb +4 -2
  38. data/lib/ruby_lsp/requests/prepare_type_hierarchy.rb +1 -2
  39. data/lib/ruby_lsp/requests/references.rb +2 -1
  40. data/lib/ruby_lsp/requests/rename.rb +8 -5
  41. data/lib/ruby_lsp/requests/semantic_highlighting.rb +4 -4
  42. data/lib/ruby_lsp/requests/show_syntax_tree.rb +1 -1
  43. data/lib/ruby_lsp/requests/support/common.rb +3 -1
  44. data/lib/ruby_lsp/requests/support/rubocop_formatter.rb +2 -2
  45. data/lib/ruby_lsp/requests/support/source_uri.rb +1 -1
  46. data/lib/ruby_lsp/response_builders/document_symbol.rb +3 -2
  47. data/lib/ruby_lsp/response_builders/hover.rb +1 -1
  48. data/lib/ruby_lsp/response_builders/semantic_highlighting.rb +1 -1
  49. data/lib/ruby_lsp/scripts/compose_bundle.rb +6 -4
  50. data/lib/ruby_lsp/server.rb +12 -4
  51. data/lib/ruby_lsp/setup_bundler.rb +5 -2
  52. data/lib/ruby_lsp/static_docs.rb +8 -1
  53. data/lib/ruby_lsp/store.rb +3 -2
  54. data/lib/ruby_lsp/test_reporters/lsp_reporter.rb +152 -0
  55. data/lib/ruby_lsp/test_reporters/minitest_reporter.rb +105 -0
  56. data/lib/ruby_lsp/test_reporters/test_unit_reporter.rb +94 -0
  57. data/lib/ruby_lsp/type_inferrer.rb +4 -1
  58. metadata +6 -6
  59. data/lib/ruby_lsp/ruby_lsp_reporter_plugin.rb +0 -109
  60. data/lib/ruby_lsp/test_reporter.rb +0 -207
  61. data/lib/ruby_lsp/test_unit_test_runner.rb +0 -98
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49fceec4749d3523e5271e7e363f6f7e34203aa406d7e6c652f7950a3036a917
4
- data.tar.gz: 03db90b64dbbd29bd7485eb2bfd9657e845de82d38824d61c6f3f27439968125
3
+ metadata.gz: e54bcceea5e2a289c338ab213823ea63915ad96901f99c1976e6ad746c5c5402
4
+ data.tar.gz: 643f3843f6085d5cf7f29e1d577a94c8d994cbe932708da875e6600ca4fe4c64
5
5
  SHA512:
6
- metadata.gz: 1124cf716bf2a7c04b72c4dcce0bd830218c57b8e28a3e36267aeb9a9e28da4e63c392fff203b3546e4c10c1b63bb62e950f8413d9c569e11986828ddaf73e13
7
- data.tar.gz: 92d3fe608ca8b547fe9aba4389b5f14e193dfe11f0ceafa0c1ac5fafca3d63fe875f94d803e5c594179eaf6ccbf99a0dbede08e5efe716744b343201507d404a
6
+ metadata.gz: 49b288356198fbfe6d66e4c6f4765585e44e6b46c5bb81d18d5df547914c5f167b9ac781add2d725f5f9fda9e042dc585323672c60e27c034c80a46eb8f121e3
7
+ data.tar.gz: 95a7119a9272c5a012ea17fd90c86dc70fa6d66bf81a056ad19dd7ab891d7db9c9c596aff6342432505dd2b487212d48bbb8a28f35468268370d3856b8d1d7ee
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.23.14
1
+ 0.23.15
@@ -11,12 +11,19 @@ install_error = nil
11
11
  reboot = false
12
12
 
13
13
  workspace_uri = ARGV.first
14
+ raw_initialize_path = File.join(".ruby-lsp", "raw_initialize")
14
15
 
15
16
  raw_initialize = if workspace_uri && !workspace_uri.start_with?("--")
16
17
  # If there's an argument without `--`, then it's the server asking to compose the bundle and passing to this
17
18
  # executable the workspace URI. We can't require gems at this point, so we built a fake initialize request manually
18
19
  reboot = true
19
20
  "{\"params\":{\"workspaceFolders\":[{\"uri\":\"#{workspace_uri}\"}]}}"
21
+ elsif ARGV.include?("--retry")
22
+ # If we're trying to re-boot automatically, we can't try to read the same initialize request again from the pipe. We
23
+ # need to ensure that the retry mechanism always writes the request to a file, so that we can reuse it
24
+ content = File.read(raw_initialize_path)
25
+ File.delete(raw_initialize_path)
26
+ content
20
27
  else
21
28
  # Read the initialize request before even starting the server. We need to do this to figure out the workspace URI.
22
29
  # Editors are not required to spawn the language server process on the same directory as the workspace URI, so we need
@@ -89,7 +96,8 @@ rescue Bundler::GemNotFound, Bundler::GitError
89
96
  # scratch
90
97
  unless install_error || ARGV.include?("--retry")
91
98
  $stderr.puts("Initial bundle compose succeeded, but Bundler.setup failed. Trying to restart from scratch...")
92
- exec(Gem.ruby, File.expand_path("ruby-lsp-launcher", __dir__), *ARGV, "--retry")
99
+ File.write(raw_initialize_path, raw_initialize)
100
+ exec(Gem.ruby, __FILE__, *ARGV, "--retry")
93
101
  end
94
102
 
95
103
  $LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
@@ -94,7 +94,7 @@ module RubyIndexer
94
94
  # Remove user specified patterns
95
95
  bundle_path = Bundler.settings["path"]&.gsub(/[\\]+/, "/")
96
96
  uris.reject! do |indexable|
97
- path = T.must(indexable.full_path)
97
+ path = indexable.full_path #: as !nil
98
98
  next false if test_files_ignored_from_exclusion?(path, bundle_path)
99
99
 
100
100
  excluded_patterns.any? { |pattern| File.fnmatch?(pattern, path, flags) }
@@ -135,7 +135,7 @@ module RubyIndexer
135
135
  existing_entries = T.cast(@index[real_nesting.join("::")], T.nilable(T::Array[Entry::SingletonClass]))
136
136
 
137
137
  if existing_entries
138
- entry = T.must(existing_entries.first)
138
+ entry = existing_entries.first #: as !nil
139
139
  entry.update_singleton_information(
140
140
  Location.from_prism_location(node.location, @code_units_cache),
141
141
  Location.from_prism_location(expression.location, @code_units_cache),
@@ -509,7 +509,10 @@ module RubyIndexer
509
509
  parent_class_name,
510
510
  )
511
511
 
512
- advance_namespace_stack(T.must(nesting.last), entry)
512
+ advance_namespace_stack(
513
+ nesting.last, #: as !nil
514
+ entry,
515
+ )
513
516
  end
514
517
 
515
518
  #: { (Index index, Entry::Namespace base) -> void } -> void
@@ -927,7 +930,7 @@ module RubyIndexer
927
930
 
928
931
  #: -> VisibilityScope
929
932
  def current_visibility_scope
930
- T.must(@visibility_stack.last)
933
+ @visibility_stack.last #: as !nil
931
934
  end
932
935
 
933
936
  #: (Prism::ParametersNode? parameters_node) -> Array[Entry::Parameter]
@@ -52,9 +52,11 @@ module RubyIndexer
52
52
  #: -> String
53
53
  def file_name
54
54
  if @uri.scheme == "untitled"
55
- T.must(@uri.opaque)
55
+ @uri.opaque #: as !nil
56
56
  else
57
- File.basename(T.must(file_path))
57
+ File.basename(
58
+ file_path, #: as !nil
59
+ )
58
60
  end
59
61
  end
60
62
 
@@ -126,7 +126,13 @@ module RubyIndexer
126
126
 
127
127
  (@entries[name] ||= []) << entry
128
128
  (@uris_to_entries[entry.uri.to_s] ||= []) << entry
129
- @entries_tree.insert(name, T.must(@entries[name])) unless skip_prefix_tree
129
+
130
+ unless skip_prefix_tree
131
+ @entries_tree.insert(
132
+ name,
133
+ @entries[name], #: as !nil
134
+ )
135
+ end
130
136
  end
131
137
 
132
138
  #: (String fully_qualified_name) -> Array[Entry]?
@@ -188,7 +194,8 @@ module RubyIndexer
188
194
  end
189
195
 
190
196
  results = nesting.length.downto(0).flat_map do |i|
191
- prefix = T.must(nesting[0...i]).join("::")
197
+ prefix = nesting[0...i] #: as !nil
198
+ .join("::")
192
199
  namespaced_query = prefix.empty? ? query : "#{prefix}::#{query}"
193
200
  @entries_tree.search(namespaced_query)
194
201
  end
@@ -288,7 +295,8 @@ module RubyIndexer
288
295
 
289
296
  # Constants defined in enclosing scopes
290
297
  nesting.length.downto(1) do |i|
291
- namespace = T.must(nesting[0...i]).join("::")
298
+ namespace = nesting[0...i] #: as !nil
299
+ .join("::")
292
300
  entries.concat(@entries_tree.search("#{namespace}::#{name}"))
293
301
  end
294
302
 
@@ -406,7 +414,8 @@ module RubyIndexer
406
414
  # Indexes a File URI by reading the contents from disk
407
415
  #: (URI::Generic uri, ?collect_comments: bool) -> void
408
416
  def index_file(uri, collect_comments: true)
409
- index_single(uri, File.read(T.must(uri.full_path)), collect_comments: collect_comments)
417
+ path = uri.full_path #: as !nil
418
+ index_single(uri, File.read(path), collect_comments: collect_comments)
410
419
  rescue Errno::EISDIR, Errno::ENOENT
411
420
  # If `path` is a directory, just ignore it and continue indexing. If the file doesn't exist, then we also ignore
412
421
  # it
@@ -428,7 +437,8 @@ module RubyIndexer
428
437
  real_parts = []
429
438
 
430
439
  (parts.length - 1).downto(0) do |i|
431
- current_name = T.must(parts[0..i]).join("::")
440
+ current_name = parts[0..i] #: as !nil
441
+ .join("::")
432
442
  entry = @entries[current_name]&.first
433
443
 
434
444
  case entry
@@ -445,7 +455,9 @@ module RubyIndexer
445
455
  target = resolved.target
446
456
  return follow_aliased_namespace("#{target}::#{real_parts.join("::")}", seen_names)
447
457
  else
448
- real_parts.unshift(T.must(parts[i]))
458
+ real_parts.unshift(
459
+ parts[i], #: as !nil
460
+ )
449
461
  end
450
462
  end
451
463
 
@@ -542,11 +554,12 @@ module RubyIndexer
542
554
 
543
555
  # The original nesting where we discovered this namespace, so that we resolve the correct names of the
544
556
  # included/prepended/extended modules and parent classes
545
- nesting = T.must(namespaces.first).nesting.flat_map { |n| n.split("::") }
557
+ nesting = namespaces.first #: as !nil
558
+ .nesting.flat_map { |n| n.split("::") }
546
559
 
547
560
  if nesting.any?
548
561
  singleton_levels.times do
549
- nesting << "<Class:#{T.must(nesting.last)}>"
562
+ nesting << "<Class:#{nesting.last}>"
550
563
  end
551
564
  end
552
565
 
@@ -612,7 +625,8 @@ module RubyIndexer
612
625
  name_parts = owner_name.split("::")
613
626
 
614
627
  if name_parts.last&.start_with?("<Class:")
615
- attached_name = T.must(name_parts[0..-2]).join("::")
628
+ attached_name = name_parts[0..-2] #: as !nil
629
+ .join("::")
616
630
  attached_ancestors = linearized_ancestors_of(attached_name)
617
631
  variables.concat(class_variables.select { |e| attached_ancestors.any?(e.owner&.name) })
618
632
  else
@@ -649,7 +663,10 @@ module RubyIndexer
649
663
  block.call(self)
650
664
  else
651
665
  delete(uri)
652
- index_single(uri, T.must(source))
666
+ index_single(
667
+ uri,
668
+ source, #: as !nil
669
+ )
653
670
  end
654
671
 
655
672
  updated_entries = @uris_to_entries[key]
@@ -699,7 +716,7 @@ module RubyIndexer
699
716
  singleton = T.cast(self[full_singleton_name]&.first, T.nilable(Entry::SingletonClass))
700
717
 
701
718
  unless singleton
702
- attached_ancestor = T.must(self[name]&.first)
719
+ attached_ancestor = self[name]&.first #: as !nil
703
720
 
704
721
  singleton = Entry::SingletonClass.new(
705
722
  [full_singleton_name],
@@ -732,7 +749,8 @@ module RubyIndexer
732
749
  name_parts = name.split("::")
733
750
 
734
751
  if name_parts.last&.start_with?("<Class:")
735
- attached_name = T.must(name_parts[0..-2]).join("::")
752
+ attached_name = name_parts[0..-2] #: as !nil
753
+ .join("::")
736
754
  linearized_ancestors_of(attached_name)
737
755
  else
738
756
  linearized_ancestors_of(name)
@@ -755,7 +773,8 @@ module RubyIndexer
755
773
  resolved_modules = resolve(operation.module_name, nesting)
756
774
  next unless resolved_modules
757
775
 
758
- module_name = T.must(resolved_modules.first).name
776
+ module_name = resolved_modules.first #: as !nil
777
+ .name
759
778
 
760
779
  # Then we grab any hooks registered for that module
761
780
  hooks = @included_hooks[module_name]
@@ -778,7 +797,8 @@ module RubyIndexer
778
797
  resolved_module = resolve(operation.module_name, nesting)
779
798
  next unless resolved_module
780
799
 
781
- module_fully_qualified_name = T.must(resolved_module.first).name
800
+ module_fully_qualified_name = resolved_module.first #: as !nil
801
+ .name
782
802
 
783
803
  case operation
784
804
  when Entry::Prepend
@@ -790,20 +810,20 @@ module RubyIndexer
790
810
  # When there are duplicate prepended modules, we have to insert the new prepends after the existing ones. For
791
811
  # example, if the current ancestors are `["A", "Foo"]` and we try to prepend `["A", "B"]`, then `"B"` has to
792
812
  # be inserted after `"A`
793
- uniq_prepends = linearized_prepends - T.must(ancestors[0...main_namespace_index])
813
+ prepended_ancestors = ancestors[0...main_namespace_index] #: as !nil
814
+ uniq_prepends = linearized_prepends - prepended_ancestors
794
815
  insert_position = linearized_prepends.length - uniq_prepends.length
795
816
 
796
- T.unsafe(ancestors).insert(
797
- insert_position,
798
- *(linearized_prepends - T.must(ancestors[0...main_namespace_index])),
799
- )
817
+ ancestors #: as untyped
818
+ .insert(insert_position, *uniq_prepends)
800
819
 
801
820
  main_namespace_index += linearized_prepends.length
802
821
  when Entry::Include
803
822
  # When including a module, Ruby will always prevent duplicate entries in case the module has already been
804
823
  # prepended or included
805
824
  linearized_includes = linearized_ancestors_of(module_fully_qualified_name)
806
- T.unsafe(ancestors).insert(main_namespace_index + 1, *(linearized_includes - ancestors))
825
+ ancestors #: as untyped
826
+ .insert(main_namespace_index + 1, *(linearized_includes - ancestors))
807
827
  end
808
828
  end
809
829
  end
@@ -833,7 +853,7 @@ module RubyIndexer
833
853
  if superclass
834
854
  # If the user makes a mistake and creates a class that inherits from itself, this method would throw a stack
835
855
  # error. We need to ensure that this isn't the case
836
- parent_class = T.must(superclass.parent_class)
856
+ parent_class = superclass.parent_class #: as !nil
837
857
 
838
858
  resolved_parent_class = resolve(parent_class, nesting)
839
859
  parent_class_name = resolved_parent_class&.first&.name
@@ -888,11 +908,12 @@ module RubyIndexer
888
908
  target = resolve(entry.target, entry.nesting, seen_names)
889
909
  return entry unless target
890
910
 
891
- target_name = T.must(target.first).name
911
+ target_name = target.first #: as !nil
912
+ .name
892
913
  resolved_alias = Entry::ConstantAlias.new(target_name, entry)
893
914
 
894
915
  # Replace the UnresolvedAlias by a resolved one so that we don't have to do this again later
895
- original_entries = T.must(@entries[alias_name])
916
+ original_entries = @entries[alias_name] #: as !nil
896
917
  original_entries.delete(entry)
897
918
  original_entries << resolved_alias
898
919
 
@@ -904,7 +925,8 @@ module RubyIndexer
904
925
  #: (String name, Array[String] nesting, Array[String] seen_names) -> Array[(Entry::Namespace | Entry::ConstantAlias | Entry::UnresolvedConstantAlias)]?
905
926
  def lookup_enclosing_scopes(name, nesting, seen_names)
906
927
  nesting.length.downto(1) do |i|
907
- namespace = T.must(nesting[0...i]).join("::")
928
+ namespace = nesting[0...i] #: as !nil
929
+ .join("::")
908
930
 
909
931
  # If we find an entry with `full_name` directly, then we can already return it, even if it contains aliases -
910
932
  # because the user might be trying to jump to the alias definition.
@@ -928,7 +950,9 @@ module RubyIndexer
928
950
  namespace_entries = resolve(nesting_parts.join("::"), [], seen_names)
929
951
  return unless namespace_entries
930
952
 
931
- ancestors = nesting_parts.empty? ? [] : linearized_ancestors_of(T.must(namespace_entries.first).name)
953
+ namespace_name = namespace_entries.first #: as !nil
954
+ .name
955
+ ancestors = nesting_parts.empty? ? [] : linearized_ancestors_of(namespace_name)
932
956
 
933
957
  ancestors.each do |ancestor_name|
934
958
  entries = direct_or_aliased_constant("#{ancestor_name}::#{constant_name}", seen_names)
@@ -952,7 +976,9 @@ module RubyIndexer
952
976
  end
953
977
  return [] unless namespace_entries
954
978
 
955
- ancestors = linearized_ancestors_of(T.must(namespace_entries.first).name)
979
+ namespace_name = namespace_entries.first #: as !nil
980
+ .name
981
+ ancestors = linearized_ancestors_of(namespace_name)
956
982
  candidates = ancestors.flat_map do |ancestor_name|
957
983
  @entries_tree.search("#{ancestor_name}::#{constant_name}")
958
984
  end
@@ -960,7 +986,8 @@ module RubyIndexer
960
986
  # For candidates with the same name, we must only show the first entry in the inheritance chain, since that's the
961
987
  # one the user will be referring to in completion
962
988
  completion_items = candidates.each_with_object({}) do |entries, hash|
963
- *parts, short_name = T.must(entries.first).name.split("::")
989
+ *parts, short_name = entries.first #: as !nil
990
+ .name.split("::")
964
991
  namespace_name = parts.join("::")
965
992
  ancestor_index = ancestors.index(namespace_name)
966
993
  existing_entry, existing_entry_index = hash[short_name]
@@ -1027,8 +1054,11 @@ module RubyIndexer
1027
1054
  target_method_entries = resolve_method(entry.old_name, receiver_name, seen_names)
1028
1055
  return entry unless target_method_entries
1029
1056
 
1030
- resolved_alias = Entry::MethodAlias.new(T.must(target_method_entries.first), entry)
1031
- original_entries = T.must(@entries[new_name])
1057
+ resolved_alias = Entry::MethodAlias.new(
1058
+ target_method_entries.first, #: as !nil
1059
+ entry,
1060
+ )
1061
+ original_entries = @entries[new_name] #: as !nil
1032
1062
  original_entries.delete(entry)
1033
1063
  original_entries << resolved_alias
1034
1064
  resolved_alias
@@ -78,7 +78,7 @@ module RubyIndexer
78
78
  return unless node
79
79
 
80
80
  # Remove the node from the tree and then go up the parents to remove any of them with empty children
81
- parent = T.must(node.parent) #: Node[Value]?
81
+ parent = node.parent #: Node[Value]?
82
82
 
83
83
  while parent
84
84
  parent.children.delete(node.key)
@@ -138,10 +138,11 @@ module RubyIndexer
138
138
  #: -> Array[Value]
139
139
  def collect
140
140
  result = []
141
- result << @value if @leaf
141
+ stack = [self]
142
142
 
143
- @children.each_value do |node|
144
- result.concat(node.collect)
143
+ while (node = stack.pop)
144
+ result << node.value if node.leaf
145
+ stack.concat(node.children.values)
145
146
  end
146
147
 
147
148
  result
@@ -282,7 +282,11 @@ module RubyIndexer
282
282
  #: (Prism::CallNode node) -> void
283
283
  def on_call_node_enter(node)
284
284
  if @target.is_a?(MethodTarget) && (name = node.name.to_s) == @target.method_name
285
- @references << Reference.new(name, T.must(node.message_loc), declaration: false)
285
+ @references << Reference.new(
286
+ name,
287
+ node.message_loc, #: as !nil
288
+ declaration: false,
289
+ )
286
290
  end
287
291
  end
288
292
 
@@ -14,8 +14,8 @@ module RubyIndexer
14
14
 
15
15
  assert_entry("@@bar", Entry::ClassVariable, "/fake/path/foo.rb:1-2:1-7")
16
16
 
17
- entry = T.must(@index["@@bar"]&.first)
18
- owner = T.must(entry.owner)
17
+ entry = @index["@@bar"]&.first #: as Entry::ClassVariable
18
+ owner = entry.owner #: as !nil
19
19
  assert_instance_of(Entry::Class, owner)
20
20
  assert_equal("Foo", owner.name)
21
21
  end
@@ -50,13 +50,13 @@ module RubyIndexer
50
50
  assert_entry("@@foo", Entry::ClassVariable, "/fake/path/foo.rb:1-2:1-7")
51
51
  assert_entry("@@bar", Entry::ClassVariable, "/fake/path/foo.rb:1-9:1-14")
52
52
 
53
- entry = T.must(@index["@@foo"]&.first)
54
- owner = T.must(entry.owner)
53
+ entry = @index["@@foo"]&.first #: as Entry::ClassVariable
54
+ owner = entry.owner #: as !nil
55
55
  assert_instance_of(Entry::Class, owner)
56
56
  assert_equal("Foo", owner.name)
57
57
 
58
- entry = T.must(@index["@@bar"]&.first)
59
- owner = T.must(entry.owner)
58
+ entry = @index["@@bar"]&.first #: as Entry::ClassVariable
59
+ owner = entry.owner #: as !nil
60
60
  assert_instance_of(Entry::Class, owner)
61
61
  assert_equal("Foo", owner.name)
62
62
  end
@@ -83,10 +83,10 @@ module RubyIndexer
83
83
 
84
84
  def test_top_level_class_variable
85
85
  index(<<~RUBY)
86
- @foo = 123
86
+ @@foo = 123
87
87
  RUBY
88
88
 
89
- entry = T.must(@index["@foo"]&.first)
89
+ entry = @index["@@foo"]&.first #: as Entry::ClassVariable
90
90
  assert_nil(entry.owner)
91
91
  end
92
92
 
@@ -99,8 +99,8 @@ module RubyIndexer
99
99
  end
100
100
  RUBY
101
101
 
102
- entry = T.must(@index["@@bar"]&.first)
103
- owner = T.must(entry.owner)
102
+ entry = @index["@@bar"]&.first #: as Entry::ClassVariable
103
+ owner = entry.owner #: as !nil
104
104
  assert_instance_of(Entry::Class, owner)
105
105
  assert_equal("Foo", owner.name)
106
106
  end
@@ -114,8 +114,8 @@ module RubyIndexer
114
114
  end
115
115
  RUBY
116
116
 
117
- entry = T.must(@index["@@bar"]&.first)
118
- owner = T.must(entry.owner)
117
+ entry = @index["@@bar"]&.first #: as Entry::ClassVariable
118
+ owner = entry.owner #: as !nil
119
119
  assert_instance_of(Entry::Class, owner)
120
120
  assert_equal("Foo", owner.name)
121
121
  end
@@ -131,8 +131,8 @@ module RubyIndexer
131
131
  end
132
132
  RUBY
133
133
 
134
- entry = T.must(@index["@@bar"]&.first)
135
- owner = T.must(entry.owner)
134
+ entry = @index["@@bar"]&.first #: as Entry::ClassVariable
135
+ owner = entry.owner #: as !nil
136
136
  assert_instance_of(Entry::Class, owner)
137
137
  assert_equal("Foo", owner.name)
138
138
  end