solargraph 0.44.2 → 0.44.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fd55900ebfdb84f10fa5ba2cb7e5fcc6dc7af0e51efe6a5d230ebaf497ec75c
4
- data.tar.gz: 859e3d6738c17b1fc9241dbc4ed9e7f4fa117556bb7767915de0178fc2a50721
3
+ metadata.gz: f8ff2cf72eecc4a36760b60491151cbedb17e11ac665ef20609e0291b2e4b64e
4
+ data.tar.gz: ea35a1bb406f5c185df0943b483676360b3c0e3df9f4fb476a246174dc37b542
5
5
  SHA512:
6
- metadata.gz: fb53ed887a2d25be28655486de35cb87deac7a604eae688bc20be8c34a696dc86d9dbcf6d069f908316078d653e06f4f00154e23eae411876a8f5cd191dfa51d
7
- data.tar.gz: f7e65200040c8a2bfd7f73e4ad7aa718dc7378fcb99850802fcd2b7ab212b59cf6ae215e21dcd7f1158291551ab211bc836113e9c06d389f6c17fb69de27457f
6
+ metadata.gz: 152ad48cda1f002d12f4e27e11bbc090be72a113246521d1a03e4a82f0d920e885f39cf8eef46d12c588d66afe0b4835cb16b2192ceaa16f1ad6d8c9631a9677
7
+ data.tar.gz: ef1f6ecfa30e9eb58080cdf09c94e1611f35f8f2f64ecc8fcfb0e359aa4b95551cf5cfb7d1ec749e023bcd9045118bb33fc0bc1756c4449aa8959ce6aa73b6d8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.44.3 - January 22, 2022
2
+ - TypeChecker validates aliased namespaces (#497)
3
+ - Always use reference YARD tags when resolving param types (#515) (#516)
4
+ - Skip method aliases in strict type checking
5
+
1
6
  ## 0.44.2 - November 23, 2021
2
7
  - Scope local variables in class_eval blocks (#503)
3
8
  - Fix invalid UTF-8 in node comments (#504)
@@ -29,16 +29,6 @@ module Solargraph
29
29
  NodeProcessor.process(source.node, Region.new(source: source))
30
30
  end
31
31
 
32
- # def returns_from node
33
- # return [] unless Parser.is_ast_node?(node)
34
- # if node.type == :SCOPE
35
- # # node.children.select { |n| n.is_a?(RubyVM::AbstractSyntaxTree::Node) }.map { |n| DeepInference.get_return_nodes(n) }.flatten
36
- # DeepInference.get_return_nodes(node.children[2])
37
- # else
38
- # DeepInference.get_return_nodes(node)
39
- # end
40
- # end
41
-
42
32
  def references source, name
43
33
  if name.end_with?("=")
44
34
  reg = /#{Regexp.escape name[0..-2]}\s*=/
@@ -145,10 +145,7 @@ module Solargraph
145
145
  # meths.shift # Ignore the first one
146
146
  meths.each do |meth|
147
147
  found = nil
148
- params = meth.docstring.tags(:param)
149
- if params.empty?
150
- params = see_reference(docstring, api_map)
151
- end
148
+ params = meth.docstring.tags(:param) + see_reference(docstring, api_map)
152
149
  params.each do |p|
153
150
  next unless p.name == name
154
151
  found = p
@@ -84,12 +84,13 @@ module Solargraph
84
84
  # @param pin [Pin::Method]
85
85
  # @return [Array<Problem>]
86
86
  def method_return_type_problems_for pin
87
+ return [] if pin.is_a?(Pin::MethodAlias)
87
88
  result = []
88
89
  declared = pin.typify(api_map).self_to(pin.full_context.namespace)
89
90
  if declared.undefined?
90
91
  if pin.return_type.undefined? && rules.require_type_tags?
91
92
  result.push Problem.new(pin.location, "Missing @return tag for #{pin.path}", pin: pin)
92
- elsif pin.return_type.defined?
93
+ elsif pin.return_type.defined? && !resolved_constant?(pin)
93
94
  result.push Problem.new(pin.location, "Unresolved return type #{pin.return_type} for #{pin.path}", pin: pin)
94
95
  elsif rules.must_tag_or_infer? && pin.probe(api_map).undefined?
95
96
  result.push Problem.new(pin.location, "Untyped method #{pin.path} could not be inferred")
@@ -111,6 +112,15 @@ module Solargraph
111
112
  result
112
113
  end
113
114
 
115
+ # @todo This is not optimal. A better solution would probably be to mix
116
+ # namespace alias into types at the ApiMap level.
117
+ #
118
+ # @param pin [Pin::Base]
119
+ # @return [Boolean]
120
+ def resolved_constant? pin
121
+ api_map.get_constants('', pin.binder.tag).any? { |pin| pin.name == pin.return_type.namespace && ['Class', 'Module'].include?(pin.return_type.name) }
122
+ end
123
+
114
124
  def virtual_pin? pin
115
125
  pin.location && source_map.source.comment_at?(pin.location.range.ending)
116
126
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = '0.44.2'
4
+ VERSION = '0.44.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.44.2
4
+ version: 0.44.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-23 00:00:00.000000000 Z
11
+ date: 2022-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backport