solargraph 0.54.2 → 0.54.3
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/CHANGELOG.md +9 -0
- data/lib/solargraph/api_map/cache.rb +10 -1
- data/lib/solargraph/api_map/index.rb +167 -0
- data/lib/solargraph/api_map/store.rb +48 -120
- data/lib/solargraph/api_map.rb +17 -5
- data/lib/solargraph/complex_type/unique_type.rb +21 -1
- data/lib/solargraph/complex_type.rb +13 -12
- data/lib/solargraph/convention.rb +1 -0
- data/lib/solargraph/doc_map.rb +1 -0
- data/lib/solargraph/equality.rb +33 -0
- data/lib/solargraph/language_server/host/message_worker.rb +3 -0
- data/lib/solargraph/language_server/host.rb +2 -1
- data/lib/solargraph/language_server/message/base.rb +1 -1
- data/lib/solargraph/language_server/message/initialize.rb +3 -1
- data/lib/solargraph/language_server/message/text_document/formatting.rb +4 -0
- data/lib/solargraph/library.rb +3 -1
- data/lib/solargraph/location.rb +7 -0
- data/lib/solargraph/parser/node_methods.rb +1 -1
- data/lib/solargraph/parser/node_processor.rb +1 -0
- data/lib/solargraph/parser/parser_gem/node_chainer.rb +3 -3
- data/lib/solargraph/parser/parser_gem/node_methods.rb +2 -2
- data/lib/solargraph/pin/base.rb +27 -16
- data/lib/solargraph/pin/base_variable.rb +3 -2
- data/lib/solargraph/pin/callable.rb +3 -3
- data/lib/solargraph/pin/method.rb +6 -0
- data/lib/solargraph/pin/namespace.rb +1 -1
- data/lib/solargraph/pin/parameter.rb +2 -1
- data/lib/solargraph/position.rb +7 -0
- data/lib/solargraph/range.rb +7 -0
- data/lib/solargraph/rbs_map/conversions.rb +1 -1
- data/lib/solargraph/rbs_map.rb +1 -0
- data/lib/solargraph/shell.rb +2 -0
- data/lib/solargraph/source/chain/array.rb +1 -1
- data/lib/solargraph/source/chain/call.rb +9 -4
- data/lib/solargraph/source/chain/hash.rb +5 -0
- data/lib/solargraph/source/chain/if.rb +5 -0
- data/lib/solargraph/source/chain/link.rb +17 -5
- data/lib/solargraph/source/chain/literal.rb +5 -0
- data/lib/solargraph/source/chain.rb +33 -19
- data/lib/solargraph/source/cursor.rb +1 -1
- data/lib/solargraph/source.rb +2 -1
- data/lib/solargraph/source_map/clip.rb +1 -1
- data/lib/solargraph/type_checker.rb +8 -8
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/workspace/config.rb +7 -3
- data/lib/solargraph/workspace.rb +1 -1
- data/lib/solargraph/yard_map/mapper/to_constant.rb +1 -0
- data/lib/solargraph/yard_map/mapper/to_namespace.rb +1 -0
- data/lib/solargraph/yard_map/mapper.rb +1 -0
- data/lib/solargraph.rb +1 -0
- data/solargraph.gemspec +1 -1
- metadata +10 -2
@@ -94,6 +94,9 @@ module Solargraph
|
|
94
94
|
# True if the message requires a previous update to have executed in
|
95
95
|
# order to work correctly.
|
96
96
|
#
|
97
|
+
# @param msg [Hash{String => Object}]
|
98
|
+
# @todo need boolish type from RBS
|
99
|
+
# @return [Object]
|
97
100
|
def version_dependent? msg
|
98
101
|
msg['textDocument'] && msg['position']
|
99
102
|
end
|
@@ -471,6 +471,7 @@ module Solargraph
|
|
471
471
|
def locate_pins params
|
472
472
|
return [] unless params['data'] && params['data']['uri']
|
473
473
|
library = library_for(params['data']['uri'])
|
474
|
+
# @type [Array<Pin::Base>]
|
474
475
|
result = []
|
475
476
|
if params['data']['location']
|
476
477
|
location = Location.new(
|
@@ -570,7 +571,7 @@ module Solargraph
|
|
570
571
|
# @param column [Integer]
|
571
572
|
# @param strip [Boolean] Strip special characters from variable names
|
572
573
|
# @param only [Boolean] If true, search current file only
|
573
|
-
# @return [Array<Solargraph::
|
574
|
+
# @return [Array<Solargraph::Location>]
|
574
575
|
def references_from uri, line, column, strip: true, only: false
|
575
576
|
library = library_for(uri)
|
576
577
|
library.references_from(uri_to_file(uri), line, column, strip: strip, only: only)
|
@@ -16,7 +16,7 @@ module Solargraph
|
|
16
16
|
# @return [String]
|
17
17
|
attr_reader :method
|
18
18
|
|
19
|
-
# @return [Hash{String => Array
|
19
|
+
# @return [Hash{String => Array<undefined>, Hash{String => undefined}, String, Integer}]
|
20
20
|
attr_reader :params
|
21
21
|
|
22
22
|
# @return [Hash, Array, nil]
|
@@ -174,7 +174,9 @@ module Solargraph
|
|
174
174
|
|
175
175
|
# @param section [String]
|
176
176
|
# @param capability [String]
|
177
|
-
# @
|
177
|
+
# @todo Need support for RBS' boolish "type", which doesn't
|
178
|
+
# enforce strict true/false-ness
|
179
|
+
# @sg-ignore
|
178
180
|
def dynamic_registration_for? section, capability
|
179
181
|
result = (params['capabilities'] &&
|
180
182
|
params['capabilities'][section] &&
|
@@ -33,6 +33,7 @@ module Solargraph
|
|
33
33
|
|
34
34
|
private
|
35
35
|
|
36
|
+
# @param corrections [String]
|
36
37
|
def log_corrections(corrections)
|
37
38
|
corrections = corrections&.strip
|
38
39
|
return if corrections&.empty?
|
@@ -51,6 +52,7 @@ module Solargraph
|
|
51
52
|
conf['rubocop'] || {}
|
52
53
|
end
|
53
54
|
|
55
|
+
# @param config [Hash{String => String}]
|
54
56
|
def cli_args file_uri, config
|
55
57
|
file = UriHelpers.uri_to_file(file_uri)
|
56
58
|
args = [
|
@@ -68,6 +70,7 @@ module Solargraph
|
|
68
70
|
args + [file]
|
69
71
|
end
|
70
72
|
|
73
|
+
# @param config [Hash{String => String}]
|
71
74
|
def formatter_class(config)
|
72
75
|
if self.class.const_defined?('BlankRubocopFormatter')
|
73
76
|
# @sg-ignore
|
@@ -79,6 +82,7 @@ module Solargraph
|
|
79
82
|
end
|
80
83
|
end
|
81
84
|
|
85
|
+
# @param value [Array, String]
|
82
86
|
def cop_list(value)
|
83
87
|
value = value.join(',') if value.respond_to?(:join)
|
84
88
|
return nil if value == '' || !value.is_a?(String)
|
data/lib/solargraph/library.rb
CHANGED
@@ -240,7 +240,7 @@ module Solargraph
|
|
240
240
|
# @param column [Integer]
|
241
241
|
# @param strip [Boolean] Strip special characters from variable names
|
242
242
|
# @param only [Boolean] Search for references in the current file only
|
243
|
-
# @return [Array<Solargraph::
|
243
|
+
# @return [Array<Solargraph::Location>]
|
244
244
|
# @todo Take a Location instead of filename/line/column
|
245
245
|
def references_from filename, line, column, strip: false, only: false
|
246
246
|
sync_catalog
|
@@ -398,6 +398,8 @@ module Solargraph
|
|
398
398
|
return [] unless open?(filename)
|
399
399
|
result = []
|
400
400
|
source = read(filename)
|
401
|
+
|
402
|
+
# @type [Hash{Class<Solargraph::Diagnostics::Base> => Array<String>}]
|
401
403
|
repargs = {}
|
402
404
|
workspace.config.reporters.each do |line|
|
403
405
|
if line == 'all!'
|
data/lib/solargraph/location.rb
CHANGED
@@ -5,6 +5,8 @@ module Solargraph
|
|
5
5
|
# and Range.
|
6
6
|
#
|
7
7
|
class Location
|
8
|
+
include Equality
|
9
|
+
|
8
10
|
# @return [String]
|
9
11
|
attr_reader :filename
|
10
12
|
|
@@ -18,6 +20,11 @@ module Solargraph
|
|
18
20
|
@range = range
|
19
21
|
end
|
20
22
|
|
23
|
+
# @sg-ignore Fix "Not enough arguments to Module#protected"
|
24
|
+
protected def equality_fields
|
25
|
+
[filename, range]
|
26
|
+
end
|
27
|
+
|
21
28
|
# @param location [self]
|
22
29
|
def contain? location
|
23
30
|
range.contain?(location.range.start) && range.contain?(location.range.ending) && filename == location.filename
|
@@ -94,11 +94,11 @@ module Solargraph
|
|
94
94
|
elsif n.type == :lvar
|
95
95
|
result.push Chain::Call.new(n.children[0].to_s)
|
96
96
|
elsif n.type == :ivar
|
97
|
-
|
97
|
+
result.push Chain::InstanceVariable.new(n.children[0].to_s)
|
98
98
|
elsif n.type == :cvar
|
99
|
-
|
99
|
+
result.push Chain::ClassVariable.new(n.children[0].to_s)
|
100
100
|
elsif n.type == :gvar
|
101
|
-
|
101
|
+
result.push Chain::GlobalVariable.new(n.children[0].to_s)
|
102
102
|
elsif n.type == :or_asgn
|
103
103
|
# @todo: Need a new Link class here that evaluates the
|
104
104
|
# existing variable type with the RHS, and generates a
|
@@ -12,7 +12,7 @@ require 'ast'
|
|
12
12
|
# class Node
|
13
13
|
# # New children
|
14
14
|
#
|
15
|
-
# # @return [Array<
|
15
|
+
# # @return [Array<self>]
|
16
16
|
# attr_reader :children
|
17
17
|
# end
|
18
18
|
# end
|
@@ -462,7 +462,7 @@ module Solargraph
|
|
462
462
|
result
|
463
463
|
end
|
464
464
|
|
465
|
-
# @param nodes [Enumerable<Parser::AST::Node,
|
465
|
+
# @param nodes [Enumerable<Parser::AST::Node, BasicObject>]
|
466
466
|
# @return [Array<Parser::AST::Node, nil>]
|
467
467
|
def reduce_to_value_nodes nodes
|
468
468
|
result = []
|
data/lib/solargraph/pin/base.rb
CHANGED
@@ -78,7 +78,7 @@ module Solargraph
|
|
78
78
|
!return_type || return_type.all_rooted?
|
79
79
|
end
|
80
80
|
|
81
|
-
# @param generics_to_erase [
|
81
|
+
# @param generics_to_erase [::Array<String>]
|
82
82
|
# @return [self]
|
83
83
|
def erase_generics(generics_to_erase)
|
84
84
|
return self if generics_to_erase.empty?
|
@@ -102,7 +102,7 @@ module Solargraph
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def to_s
|
105
|
-
|
105
|
+
desc
|
106
106
|
end
|
107
107
|
|
108
108
|
# @return [Boolean]
|
@@ -115,14 +115,6 @@ module Solargraph
|
|
115
115
|
location || type_location
|
116
116
|
end
|
117
117
|
|
118
|
-
# Pin equality is determined using the #nearly? method and also
|
119
|
-
# requiring both pins to have the same location.
|
120
|
-
#
|
121
|
-
def == other
|
122
|
-
return false unless nearly? other
|
123
|
-
comments == other.comments and location == other.location
|
124
|
-
end
|
125
|
-
|
126
118
|
# True if the specified pin is a near match to this one. A near match
|
127
119
|
# indicates that the pins contain mostly the same data. Any differences
|
128
120
|
# between them should not have an impact on the API surface.
|
@@ -139,6 +131,14 @@ module Solargraph
|
|
139
131
|
)
|
140
132
|
end
|
141
133
|
|
134
|
+
# Pin equality is determined using the #nearly? method and also
|
135
|
+
# requiring both pins to have the same location.
|
136
|
+
#
|
137
|
+
def == other
|
138
|
+
return false unless nearly? other
|
139
|
+
comments == other.comments && location == other.location
|
140
|
+
end
|
141
|
+
|
142
142
|
# The pin's return type.
|
143
143
|
#
|
144
144
|
# @return [ComplexType]
|
@@ -265,9 +265,10 @@ module Solargraph
|
|
265
265
|
result
|
266
266
|
end
|
267
267
|
|
268
|
+
# @deprecated
|
268
269
|
# @return [String]
|
269
270
|
def identity
|
270
|
-
@identity ||= "#{closure
|
271
|
+
@identity ||= "#{closure&.path}|#{name}"
|
271
272
|
end
|
272
273
|
|
273
274
|
# @return [String, nil]
|
@@ -275,19 +276,29 @@ module Solargraph
|
|
275
276
|
return_type.to_rbs
|
276
277
|
end
|
277
278
|
|
278
|
-
# @return [String
|
279
|
-
def
|
279
|
+
# @return [String]
|
280
|
+
def type_desc
|
281
|
+
rbs = to_rbs
|
282
|
+
# RBS doesn't have a way to represent a Class<x> type
|
283
|
+
rbs = return_type.rooted_tags if return_type.name == 'Class'
|
280
284
|
if path
|
281
|
-
if
|
282
|
-
path + ' ' +
|
285
|
+
if rbs
|
286
|
+
path + ' ' + rbs
|
283
287
|
else
|
284
288
|
path
|
285
289
|
end
|
286
290
|
else
|
287
|
-
|
291
|
+
rbs
|
288
292
|
end
|
289
293
|
end
|
290
294
|
|
295
|
+
# @return [String]
|
296
|
+
def desc
|
297
|
+
closure_info = closure&.desc
|
298
|
+
binder_info = binder&.desc
|
299
|
+
"[#{type_desc}, closure=#{closure_info}, binder=#{binder}"
|
300
|
+
end
|
301
|
+
|
291
302
|
def inspect
|
292
303
|
"#<#{self.class} `#{self.desc}` at #{self.location.inspect}>"
|
293
304
|
end
|
@@ -93,6 +93,7 @@ module Solargraph
|
|
93
93
|
assignment == other.assignment
|
94
94
|
end
|
95
95
|
|
96
|
+
# @param pin [self]
|
96
97
|
def try_merge! pin
|
97
98
|
return false unless super
|
98
99
|
@assignment = pin.assignment
|
@@ -100,8 +101,8 @@ module Solargraph
|
|
100
101
|
true
|
101
102
|
end
|
102
103
|
|
103
|
-
def
|
104
|
-
"#{
|
104
|
+
def type_desc
|
105
|
+
"#{super} = #{assignment&.type.inspect}"
|
105
106
|
end
|
106
107
|
|
107
108
|
private
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Solargraph
|
4
4
|
module Pin
|
5
5
|
class Callable < Closure
|
6
|
-
# @return [
|
6
|
+
# @return [Signature]
|
7
7
|
attr_reader :block
|
8
8
|
|
9
9
|
attr_reader :parameters
|
@@ -57,7 +57,7 @@ module Solargraph
|
|
57
57
|
callable
|
58
58
|
end
|
59
59
|
|
60
|
-
# @param generics_to_resolve [
|
60
|
+
# @param generics_to_resolve [::Array<String>]
|
61
61
|
# @param arg_types [Array<ComplexType>, nil]
|
62
62
|
# @param return_type_context [ComplexType, nil]
|
63
63
|
# @param yield_arg_types [Array<ComplexType>, nil]
|
@@ -113,7 +113,7 @@ module Solargraph
|
|
113
113
|
end
|
114
114
|
|
115
115
|
# @param arguments [::Array<Chain>]
|
116
|
-
# @param
|
116
|
+
# @param with_block [Boolean]
|
117
117
|
# @return [Boolean]
|
118
118
|
def arity_matches? arguments, with_block
|
119
119
|
argcount = arguments.length
|
@@ -31,6 +31,10 @@ module Solargraph
|
|
31
31
|
@anon_splat = anon_splat
|
32
32
|
end
|
33
33
|
|
34
|
+
def == other
|
35
|
+
super && other.node == node
|
36
|
+
end
|
37
|
+
|
34
38
|
def transform_types(&transform)
|
35
39
|
# @todo 'super' alone should work here I think, but doesn't typecheck at level typed
|
36
40
|
m = super(&transform)
|
@@ -262,6 +266,7 @@ module Solargraph
|
|
262
266
|
@attribute
|
263
267
|
end
|
264
268
|
|
269
|
+
# @parm other [Method]
|
265
270
|
def nearly? other
|
266
271
|
super &&
|
267
272
|
parameters == other.parameters &&
|
@@ -273,6 +278,7 @@ module Solargraph
|
|
273
278
|
attribute? ? infer_from_iv(api_map) : infer_from_return_nodes(api_map)
|
274
279
|
end
|
275
280
|
|
281
|
+
# @param pin [Pin::Method]
|
276
282
|
def try_merge! pin
|
277
283
|
return false unless super
|
278
284
|
@node = pin.node
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Solargraph
|
4
4
|
module Pin
|
5
5
|
class Parameter < LocalVariable
|
6
|
-
# @return [Symbol]
|
6
|
+
# @return [::Symbol]
|
7
7
|
attr_reader :decl
|
8
8
|
|
9
9
|
# @return [String]
|
@@ -121,6 +121,7 @@ module Solargraph
|
|
121
121
|
tag.text
|
122
122
|
end
|
123
123
|
|
124
|
+
# @param pin [Pin::Parameter]
|
124
125
|
def try_merge! pin
|
125
126
|
return false unless super && closure == pin.closure
|
126
127
|
true
|
data/lib/solargraph/position.rb
CHANGED
@@ -4,6 +4,8 @@ module Solargraph
|
|
4
4
|
# The zero-based line and column numbers of a position in a string.
|
5
5
|
#
|
6
6
|
class Position
|
7
|
+
include Equality
|
8
|
+
|
7
9
|
# @return [Integer]
|
8
10
|
attr_reader :line
|
9
11
|
|
@@ -19,6 +21,11 @@ module Solargraph
|
|
19
21
|
@character = character
|
20
22
|
end
|
21
23
|
|
24
|
+
# @sg-ignore Fix "Not enough arguments to Module#protected"
|
25
|
+
protected def equality_fields
|
26
|
+
[line, character]
|
27
|
+
end
|
28
|
+
|
22
29
|
# Get a hash of the position. This representation is suitable for use in
|
23
30
|
# the language server protocol.
|
24
31
|
#
|
data/lib/solargraph/range.rb
CHANGED
@@ -4,6 +4,8 @@ module Solargraph
|
|
4
4
|
# A pair of Positions that compose a section of text in code.
|
5
5
|
#
|
6
6
|
class Range
|
7
|
+
include Equality
|
8
|
+
|
7
9
|
# @return [Position]
|
8
10
|
attr_reader :start
|
9
11
|
|
@@ -17,6 +19,11 @@ module Solargraph
|
|
17
19
|
@ending = ending
|
18
20
|
end
|
19
21
|
|
22
|
+
# @sg-ignore Fix "Not enough arguments to Module#protected"
|
23
|
+
protected def equality_fields
|
24
|
+
[start, ending]
|
25
|
+
end
|
26
|
+
|
20
27
|
# Get a hash of the range. This representation is suitable for use in
|
21
28
|
# the language server protocol.
|
22
29
|
#
|
@@ -321,7 +321,7 @@ module Solargraph
|
|
321
321
|
# @return [void]
|
322
322
|
def method_def_to_sigs decl, pin
|
323
323
|
decl.overloads.map do |overload|
|
324
|
-
generics = overload.method_type.type_params.map(&:to_s)
|
324
|
+
generics = overload.method_type.type_params.map(&:name).map(&:to_s)
|
325
325
|
signature_parameters, signature_return_type = parts_of_function(overload.method_type, pin)
|
326
326
|
block = if overload.method_type.block
|
327
327
|
block_parameters, block_return_type = parts_of_function(overload.method_type.block, pin)
|
data/lib/solargraph/rbs_map.rb
CHANGED
data/lib/solargraph/shell.rb
CHANGED
@@ -111,6 +111,7 @@ module Solargraph
|
|
111
111
|
also be specified to clear cached system documentation.
|
112
112
|
Documentation will be regenerated as needed.
|
113
113
|
)
|
114
|
+
# @param gems [Array<String>]
|
114
115
|
# @return [void]
|
115
116
|
def uncache *gems
|
116
117
|
raise ArgumentError, 'No gems specified.' if gems.empty?
|
@@ -133,6 +134,7 @@ module Solargraph
|
|
133
134
|
|
134
135
|
desc 'gems [GEM[=VERSION]]', 'Cache documentation for installed gems'
|
135
136
|
option :rebuild, type: :boolean, desc: 'Rebuild existing documentation', default: false
|
137
|
+
# @param names [Array<String>]
|
136
138
|
# @return [void]
|
137
139
|
def gems *names
|
138
140
|
if names.empty?
|
@@ -14,7 +14,7 @@ module Solargraph
|
|
14
14
|
|
15
15
|
# @param api_map [ApiMap]
|
16
16
|
# @param name_pin [Pin::Base]
|
17
|
-
# @param locals [
|
17
|
+
# @param locals [::Array<Pin::Parameter, Pin::LocalVariable>]
|
18
18
|
def resolve api_map, name_pin, locals
|
19
19
|
child_types = @children.map do |child|
|
20
20
|
child.infer(api_map, name_pin, locals)
|
@@ -25,6 +25,11 @@ module Solargraph
|
|
25
25
|
fix_block_pass
|
26
26
|
end
|
27
27
|
|
28
|
+
# @sg-ignore Fix "Not enough arguments to Module#protected"
|
29
|
+
protected def equality_fields
|
30
|
+
super + [arguments, block]
|
31
|
+
end
|
32
|
+
|
28
33
|
def with_block?
|
29
34
|
!!@block
|
30
35
|
end
|
@@ -54,7 +59,7 @@ module Solargraph
|
|
54
59
|
# @param pins [::Enumerable<Pin::Method>]
|
55
60
|
# @param api_map [ApiMap]
|
56
61
|
# @param name_pin [Pin::Base]
|
57
|
-
# @param locals [::Array<Pin::LocalVariable>]
|
62
|
+
# @param locals [::Array<Solargraph::Pin::LocalVariable, Solargraph::Pin::Parameter>]
|
58
63
|
# @return [::Array<Pin::Base>]
|
59
64
|
def inferred_pins pins, api_map, name_pin, locals
|
60
65
|
result = pins.map do |p|
|
@@ -134,7 +139,7 @@ module Solargraph
|
|
134
139
|
# @param pin [Pin::Base]
|
135
140
|
# @param api_map [ApiMap]
|
136
141
|
# @param context [ComplexType]
|
137
|
-
# @param locals [
|
142
|
+
# @param locals [::Array<Solargraph::Pin::LocalVariable, Solargraph::Pin::Parameter>]
|
138
143
|
# @return [Pin::Base]
|
139
144
|
def process_macro pin, api_map, context, locals
|
140
145
|
pin.macros.each do |macro|
|
@@ -153,7 +158,7 @@ module Solargraph
|
|
153
158
|
# @param pin [Pin::Method]
|
154
159
|
# @param api_map [ApiMap]
|
155
160
|
# @param context [ComplexType]
|
156
|
-
# @param locals [
|
161
|
+
# @param locals [::Array<Solargraph::Pin::LocalVariable, Solargraph::Pin::Parameter>]
|
157
162
|
# @return [Pin::ProxyType]
|
158
163
|
def process_directive pin, api_map, context, locals
|
159
164
|
pin.directives.each do |dir|
|
@@ -169,7 +174,7 @@ module Solargraph
|
|
169
174
|
# @param macro [YARD::Tags::MacroDirective]
|
170
175
|
# @param api_map [ApiMap]
|
171
176
|
# @param context [ComplexType]
|
172
|
-
# @param locals [
|
177
|
+
# @param locals [::Array<Pin::LocalVariable, Pin::Parameter>]
|
173
178
|
# @return [Pin::ProxyType]
|
174
179
|
def inner_process_macro pin, macro, api_map, context, locals
|
175
180
|
vals = arguments.map{ |c| Pin::ProxyType.anonymous(c.infer(api_map, pin, locals)) }
|
@@ -13,6 +13,11 @@ module Solargraph
|
|
13
13
|
@links = links
|
14
14
|
end
|
15
15
|
|
16
|
+
# @sg-ignore Fix "Not enough arguments to Module#protected"
|
17
|
+
protected def equality_fields
|
18
|
+
super + [@links]
|
19
|
+
end
|
20
|
+
|
16
21
|
def resolve api_map, name_pin, locals
|
17
22
|
types = @links.map { |link| link.infer(api_map, name_pin, locals) }
|
18
23
|
[Solargraph::Pin::ProxyType.anonymous(Solargraph::ComplexType.try_parse(types.map(&:tag).uniq.join(', ')))]
|
@@ -4,6 +4,8 @@ module Solargraph
|
|
4
4
|
class Source
|
5
5
|
class Chain
|
6
6
|
class Link
|
7
|
+
include Equality
|
8
|
+
|
7
9
|
# @return [String]
|
8
10
|
attr_reader :word
|
9
11
|
|
@@ -15,6 +17,11 @@ module Solargraph
|
|
15
17
|
@word = word
|
16
18
|
end
|
17
19
|
|
20
|
+
# @sg-ignore Fix "Not enough arguments to Module#protected"
|
21
|
+
protected def equality_fields
|
22
|
+
[self.class, word]
|
23
|
+
end
|
24
|
+
|
18
25
|
def undefined?
|
19
26
|
word == '<undefined>'
|
20
27
|
end
|
@@ -31,18 +38,23 @@ module Solargraph
|
|
31
38
|
[]
|
32
39
|
end
|
33
40
|
|
41
|
+
# debugging description of contents; not for machine use
|
42
|
+
def desc
|
43
|
+
word
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_s
|
47
|
+
desc
|
48
|
+
end
|
49
|
+
|
34
50
|
def inspect
|
35
|
-
"
|
51
|
+
"#<#{self.class} - `#{self.desc}`>"
|
36
52
|
end
|
37
53
|
|
38
54
|
def head?
|
39
55
|
@head ||= false
|
40
56
|
end
|
41
57
|
|
42
|
-
def == other
|
43
|
-
self.class == other.class and word == other.word
|
44
|
-
end
|
45
|
-
|
46
58
|
# Make a copy of this link marked as the head of a chain
|
47
59
|
#
|
48
60
|
# @return [self]
|
@@ -14,6 +14,11 @@ module Solargraph
|
|
14
14
|
@complex_type = ComplexType.try_parse(type)
|
15
15
|
end
|
16
16
|
|
17
|
+
# @sg-ignore Fix "Not enough arguments to Module#protected"
|
18
|
+
protected def equality_fields
|
19
|
+
super + [@value, @type, @literal_type, @complex_type]
|
20
|
+
end
|
21
|
+
|
17
22
|
def resolve api_map, name_pin, locals
|
18
23
|
[Pin::ProxyType.anonymous(@complex_type)]
|
19
24
|
end
|