type-guessr 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 189f36a0b1f14badab35c3ea71b7a93d7de66606378533f087dff92e3d0d3f3d
4
- data.tar.gz: b68f73382fb0a2e171f19254c101125c10b83163555c14d8fb4b920c61288555
3
+ metadata.gz: 7783e3a53037ee36f81b86f0d78518ad46cdbf84ba63e3de3262114d82773873
4
+ data.tar.gz: 00d1c370e84981d176b78d39a10aeb0b7371ff8e8f4f046bb1cc9e7d7aad0031
5
5
  SHA512:
6
- metadata.gz: 14029ca04179fed4e548152d6a06303d70069ef27d097ec49f17d969b58c520175de6b3a1130facefc346a9fe302d0897fcdbada1d5087f08e3dfe601cbd88a8
7
- data.tar.gz: c11ad3e708e2e7ec2aa0ed7813d18967af11a07462964f5fb8426bd6c12c871a1dbd03069ba2feef6dffe517e0dd5b5c1135080ba8bbe90910533c39ffe19467
6
+ metadata.gz: 1a0f3223ed5c77a2601e9649181aea9b2db9d9e977374ccbda3a832cadf61b123b046f040ccd654c49ea1516a928d565543b1b8e80bf5d6ca630e90c29346e66
7
+ data.tar.gz: 749c0256b9402d1885a00dcf3b52f662e77bae6bccdd1d797920af0930bd875605248eb00d9e8a43a47b8626164c28ec161bd3bd72e4fda6392ceb19f58a3c38
@@ -669,12 +669,25 @@ module TypeGuessr
669
669
  )
670
670
  end
671
671
 
672
- # Try project class methods first (includes extended module methods)
673
- # Use code_index adapter to find method owner
674
- owner_name = @code_index&.class_method_owner(class_name, node.method.to_s)
672
+ # ConstantName.method is always a class method or module function, so the
673
+ # method's owner must be the receiver's singleton class. Look up the registry
674
+ # directly to avoid depending on ruby-lsp's indexer state for methods we
675
+ # ourselves registered.
676
+ singleton_scope = "#{class_name}::<Class:#{IR.extract_last_name(class_name)}>"
677
+ def_node = @method_registry.lookup(singleton_scope, node.method.to_s)
678
+ if def_node
679
+ return_result = infer(def_node)
680
+ return Result.new(
681
+ return_result.type,
682
+ "#{class_name}.#{node.method} (project)",
683
+ :project
684
+ )
685
+ end
675
686
 
676
- # Early return: project class method found
677
- if owner_name
687
+ # Fall back to code_index for inherited class methods (the method is defined
688
+ # on an ancestor, so its singleton scope differs from the receiver's).
689
+ owner_name = @code_index&.class_method_owner(class_name, node.method.to_s)
690
+ if owner_name && owner_name != singleton_scope
678
691
  def_node = @method_registry.lookup(owner_name, node.method.to_s)
679
692
  if def_node
680
693
  return_result = infer(def_node)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TypeGuessr
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: type-guessr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - riseshia