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 +4 -4
- data/lib/type_guessr/core/inference/resolver.rb +18 -5
- data/lib/type_guessr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7783e3a53037ee36f81b86f0d78518ad46cdbf84ba63e3de3262114d82773873
|
|
4
|
+
data.tar.gz: 00d1c370e84981d176b78d39a10aeb0b7371ff8e8f4f046bb1cc9e7d7aad0031
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a0f3223ed5c77a2601e9649181aea9b2db9d9e977374ccbda3a832cadf61b123b046f040ccd654c49ea1516a928d565543b1b8e80bf5d6ca630e90c29346e66
|
|
7
|
+
data.tar.gz: 749c0256b9402d1885a00dcf3b52f662e77bae6bccdd1d797920af0930bd875605248eb00d9e8a43a47b8626164c28ec161bd3bd72e4fda6392ceb19f58a3c38
|
|
@@ -669,12 +669,25 @@ module TypeGuessr
|
|
|
669
669
|
)
|
|
670
670
|
end
|
|
671
671
|
|
|
672
|
-
#
|
|
673
|
-
#
|
|
674
|
-
|
|
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
|
-
#
|
|
677
|
-
|
|
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)
|
data/lib/type_guessr/version.rb
CHANGED