solargraph 0.59.0.dev.1 → 0.59.0.dev.2
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/.github/workflows/plugins.yml +4 -1
- data/.github/workflows/rspec.yml +3 -14
- data/.gitignore +1 -0
- data/.rubocop.yml +32 -5
- data/.rubocop_todo.yml +37 -931
- data/CHANGELOG.md +7 -1
- data/Gemfile +3 -1
- data/Rakefile +25 -23
- data/bin/solargraph +2 -1
- data/lib/solargraph/api_map/index.rb +5 -11
- data/lib/solargraph/api_map/source_to_yard.rb +9 -8
- data/lib/solargraph/api_map/store.rb +22 -20
- data/lib/solargraph/api_map.rb +50 -37
- data/lib/solargraph/bench.rb +44 -45
- data/lib/solargraph/complex_type/type_methods.rb +12 -15
- data/lib/solargraph/complex_type/unique_type.rb +54 -43
- data/lib/solargraph/complex_type.rb +69 -61
- data/lib/solargraph/convention/data_definition/data_assignment_node.rb +61 -61
- data/lib/solargraph/convention/data_definition/data_definition_node.rb +4 -4
- data/lib/solargraph/convention/data_definition.rb +1 -1
- data/lib/solargraph/convention/gemfile.rb +15 -15
- data/lib/solargraph/convention/gemspec.rb +23 -23
- data/lib/solargraph/convention/rakefile.rb +17 -17
- data/lib/solargraph/convention/struct_definition/struct_assignment_node.rb +1 -1
- data/lib/solargraph/convention/struct_definition/struct_definition_node.rb +3 -3
- data/lib/solargraph/convention/struct_definition.rb +3 -3
- data/lib/solargraph/convention.rb +78 -78
- data/lib/solargraph/converters/dd.rb +19 -17
- data/lib/solargraph/converters/dl.rb +17 -15
- data/lib/solargraph/converters/dt.rb +17 -15
- data/lib/solargraph/converters/misc.rb +3 -1
- data/lib/solargraph/diagnostics/rubocop.rb +10 -10
- data/lib/solargraph/diagnostics/rubocop_helpers.rb +3 -3
- data/lib/solargraph/diagnostics/type_check.rb +10 -10
- data/lib/solargraph/diagnostics/update_errors.rb +37 -41
- data/lib/solargraph/doc_map.rb +9 -10
- data/lib/solargraph/equality.rb +3 -3
- data/lib/solargraph/gem_pins.rb +7 -5
- data/lib/solargraph/language_server/error_codes.rb +20 -20
- data/lib/solargraph/language_server/host/diagnoser.rb +89 -89
- data/lib/solargraph/language_server/host/dispatch.rb +2 -3
- data/lib/solargraph/language_server/host/message_worker.rb +2 -2
- data/lib/solargraph/language_server/host/sources.rb +1 -1
- data/lib/solargraph/language_server/host.rb +24 -21
- data/lib/solargraph/language_server/message/base.rb +97 -97
- data/lib/solargraph/language_server/message/client/register_capability.rb +13 -15
- data/lib/solargraph/language_server/message/completion_item/resolve.rb +58 -60
- data/lib/solargraph/language_server/message/extended/check_gem_version.rb +10 -11
- data/lib/solargraph/language_server/message/extended/document_gems.rb +32 -32
- data/lib/solargraph/language_server/message/extended/download_core.rb +20 -19
- data/lib/solargraph/language_server/message/extended/search.rb +20 -20
- data/lib/solargraph/language_server/message/initialize.rb +197 -191
- data/lib/solargraph/language_server/message/text_document/completion.rb +8 -8
- data/lib/solargraph/language_server/message/text_document/definition.rb +41 -34
- data/lib/solargraph/language_server/message/text_document/document_highlight.rb +23 -16
- data/lib/solargraph/language_server/message/text_document/document_symbol.rb +29 -21
- data/lib/solargraph/language_server/message/text_document/formatting.rb +6 -6
- data/lib/solargraph/language_server/message/text_document/hover.rb +3 -5
- data/lib/solargraph/language_server/message/text_document/prepare_rename.rb +18 -11
- data/lib/solargraph/language_server/message/text_document/references.rb +23 -16
- data/lib/solargraph/language_server/message/text_document/rename.rb +26 -19
- data/lib/solargraph/language_server/message/text_document/signature_help.rb +2 -2
- data/lib/solargraph/language_server/message/text_document/type_definition.rb +25 -19
- data/lib/solargraph/language_server/message/workspace/did_change_configuration.rb +41 -35
- data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +48 -40
- data/lib/solargraph/language_server/message/workspace/did_change_workspace_folders.rb +32 -26
- data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +27 -19
- data/lib/solargraph/language_server/message.rb +94 -94
- data/lib/solargraph/language_server/request.rb +29 -27
- data/lib/solargraph/language_server/transport/data_reader.rb +72 -74
- data/lib/solargraph/language_server/uri_helpers.rb +49 -49
- data/lib/solargraph/library.rb +28 -33
- data/lib/solargraph/location.rb +10 -12
- data/lib/solargraph/logging.rb +4 -4
- data/lib/solargraph/page.rb +92 -92
- data/lib/solargraph/parser/comment_ripper.rb +12 -4
- data/lib/solargraph/parser/flow_sensitive_typing.rb +32 -42
- data/lib/solargraph/parser/node_processor/base.rb +4 -4
- data/lib/solargraph/parser/node_processor.rb +1 -1
- data/lib/solargraph/parser/parser_gem/class_methods.rb +4 -4
- data/lib/solargraph/parser/parser_gem/flawed_builder.rb +19 -19
- data/lib/solargraph/parser/parser_gem/node_chainer.rb +20 -20
- data/lib/solargraph/parser/parser_gem/node_methods.rb +66 -65
- data/lib/solargraph/parser/parser_gem/node_processors/args_node.rb +12 -12
- data/lib/solargraph/parser/parser_gem/node_processors/block_node.rb +1 -1
- data/lib/solargraph/parser/parser_gem/node_processors/def_node.rb +3 -3
- data/lib/solargraph/parser/parser_gem/node_processors/defs_node.rb +38 -37
- data/lib/solargraph/parser/parser_gem/node_processors/if_node.rb +3 -3
- data/lib/solargraph/parser/parser_gem/node_processors/ivasgn_node.rb +2 -1
- data/lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb +1 -1
- data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +3 -5
- data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +118 -112
- data/lib/solargraph/parser/parser_gem/node_processors/until_node.rb +29 -29
- data/lib/solargraph/parser/parser_gem/node_processors/when_node.rb +1 -1
- data/lib/solargraph/parser/parser_gem/node_processors/while_node.rb +1 -1
- data/lib/solargraph/parser/parser_gem.rb +14 -12
- data/lib/solargraph/parser/snippet.rb +2 -0
- data/lib/solargraph/parser.rb +25 -23
- data/lib/solargraph/pin/base.rb +78 -64
- data/lib/solargraph/pin/base_variable.rb +28 -71
- data/lib/solargraph/pin/block.rb +3 -2
- data/lib/solargraph/pin/breakable.rb +2 -0
- data/lib/solargraph/pin/callable.rb +23 -26
- data/lib/solargraph/pin/closure.rb +5 -4
- data/lib/solargraph/pin/common.rb +5 -2
- data/lib/solargraph/pin/compound_statement.rb +3 -3
- data/lib/solargraph/pin/constant.rb +43 -45
- data/lib/solargraph/pin/conversions.rb +9 -4
- data/lib/solargraph/pin/delegated_method.rb +4 -4
- data/lib/solargraph/pin/documenting.rb +3 -2
- data/lib/solargraph/pin/local_variable.rb +4 -4
- data/lib/solargraph/pin/method.rb +71 -70
- data/lib/solargraph/pin/namespace.rb +13 -12
- data/lib/solargraph/pin/parameter.rb +28 -27
- data/lib/solargraph/pin/proxy_type.rb +2 -0
- data/lib/solargraph/pin/reference.rb +17 -0
- data/lib/solargraph/pin/search.rb +2 -2
- data/lib/solargraph/pin/signature.rb +9 -14
- data/lib/solargraph/pin/symbol.rb +1 -0
- data/lib/solargraph/pin/until.rb +1 -3
- data/lib/solargraph/pin/while.rb +1 -3
- data/lib/solargraph/pin_cache.rb +16 -19
- data/lib/solargraph/position.rb +35 -17
- data/lib/solargraph/range.rb +10 -9
- data/lib/solargraph/rbs_map/conversions.rb +312 -206
- data/lib/solargraph/rbs_map/core_fills.rb +91 -84
- data/lib/solargraph/rbs_map/stdlib_map.rb +0 -1
- data/lib/solargraph/rbs_map.rb +3 -12
- data/lib/solargraph/server_methods.rb +16 -16
- data/lib/solargraph/shell.rb +63 -53
- data/lib/solargraph/source/chain/array.rb +39 -37
- data/lib/solargraph/source/chain/call.rb +49 -44
- data/lib/solargraph/source/chain/class_variable.rb +13 -13
- data/lib/solargraph/source/chain/constant.rb +3 -1
- data/lib/solargraph/source/chain/global_variable.rb +13 -13
- data/lib/solargraph/source/chain/hash.rb +8 -6
- data/lib/solargraph/source/chain/if.rb +11 -10
- data/lib/solargraph/source/chain/instance_variable.rb +3 -1
- data/lib/solargraph/source/chain/link.rb +99 -109
- data/lib/solargraph/source/chain/literal.rb +4 -6
- data/lib/solargraph/source/chain/or.rb +2 -4
- data/lib/solargraph/source/chain/q_call.rb +13 -11
- data/lib/solargraph/source/chain/variable.rb +15 -13
- data/lib/solargraph/source/chain/z_super.rb +28 -30
- data/lib/solargraph/source/chain.rb +24 -16
- data/lib/solargraph/source/change.rb +3 -3
- data/lib/solargraph/source/cursor.rb +18 -18
- data/lib/solargraph/source/encoding_fixes.rb +6 -7
- data/lib/solargraph/source/source_chainer.rb +46 -32
- data/lib/solargraph/source/updater.rb +1 -1
- data/lib/solargraph/source.rb +27 -29
- data/lib/solargraph/source_map/clip.rb +38 -30
- data/lib/solargraph/source_map/mapper.rb +52 -46
- data/lib/solargraph/source_map.rb +8 -4
- data/lib/solargraph/type_checker/rules.rb +8 -8
- data/lib/solargraph/type_checker.rb +95 -101
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/workspace/config.rb +10 -9
- data/lib/solargraph/workspace/gemspecs.rb +1 -1
- data/lib/solargraph/workspace.rb +21 -44
- data/lib/solargraph/yard_map/helpers.rb +6 -2
- data/lib/solargraph/yard_map/mapper/to_method.rb +8 -6
- data/lib/solargraph/yard_map/mapper/to_namespace.rb +1 -1
- data/lib/solargraph/yard_map/mapper.rb +12 -12
- data/lib/solargraph/yard_tags.rb +20 -20
- data/lib/solargraph.rb +5 -5
- data/solargraph.gemspec +35 -34
- metadata +28 -28
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
## 0.58.2 - January 19, 2026
|
|
2
|
+
- Avoid rbs pollution (#1146)
|
|
3
|
+
- Fix 'solargraph pin --references ClassName' private method call (#1150)
|
|
4
|
+
- Improve memory efficiency of Position class (#1054)
|
|
5
|
+
- Raise InvalidOffsetError for offsets > text (#1155)
|
|
6
|
+
|
|
1
7
|
## 0.58.1 - January 2, 2026
|
|
2
|
-
-
|
|
8
|
+
- Normalize line endings to LF (#1142)
|
|
3
9
|
|
|
4
10
|
## 0.58.0 - January 1, 2026
|
|
5
11
|
- Faster constant resolution (#1083)
|
data/Gemfile
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
source 'https://rubygems.org'
|
|
2
4
|
|
|
3
5
|
gemspec name: 'solargraph'
|
|
4
6
|
|
|
5
7
|
# Local gemfile for development tools, etc.
|
|
6
|
-
local_gemfile = File.expand_path(
|
|
8
|
+
local_gemfile = File.expand_path('.Gemfile', __dir__)
|
|
7
9
|
instance_eval File.read local_gemfile if File.exist? local_gemfile
|
data/Rakefile
CHANGED
|
@@ -1,42 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'rake'
|
|
2
4
|
require 'bundler/gem_tasks'
|
|
3
5
|
require 'fileutils'
|
|
4
6
|
require 'open3'
|
|
5
7
|
|
|
6
|
-
desc
|
|
8
|
+
desc 'Open a Pry session preloaded with this library'
|
|
7
9
|
task :console do
|
|
8
|
-
sh
|
|
10
|
+
sh 'pry -I lib -r solargraph.rb'
|
|
9
11
|
end
|
|
10
12
|
|
|
11
|
-
desc
|
|
13
|
+
desc 'Run the type checker'
|
|
12
14
|
task typecheck: [:typecheck_strong]
|
|
13
15
|
|
|
14
|
-
desc
|
|
16
|
+
desc 'Run the type checker at typed level - return code issues provable without annotations being correct'
|
|
15
17
|
task :typecheck_typed do
|
|
16
|
-
sh
|
|
18
|
+
sh 'SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level typed'
|
|
17
19
|
end
|
|
18
20
|
|
|
19
|
-
desc
|
|
21
|
+
desc 'Run the type checker at strict level - report issues using type annotations'
|
|
20
22
|
task :typecheck_strict do
|
|
21
|
-
sh
|
|
23
|
+
sh 'SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level strict'
|
|
22
24
|
end
|
|
23
25
|
|
|
24
|
-
desc
|
|
26
|
+
desc 'Run the type checker at strong level - enforce that type annotations exist'
|
|
25
27
|
task :typecheck_strong do
|
|
26
|
-
sh
|
|
28
|
+
sh 'SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level strong'
|
|
27
29
|
end
|
|
28
30
|
|
|
29
|
-
desc
|
|
31
|
+
desc 'Run the type checker at alpha level - run high-false-alarm checks'
|
|
30
32
|
task :typecheck_alpha do
|
|
31
|
-
sh
|
|
33
|
+
sh 'SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level alpha'
|
|
32
34
|
end
|
|
33
35
|
|
|
34
|
-
desc
|
|
36
|
+
desc 'Run RSpec tests, starting with the ones that failed last time'
|
|
35
37
|
task spec: %i[spec_failed undercover_no_fail full_spec] do
|
|
36
38
|
undercover
|
|
37
39
|
end
|
|
38
40
|
|
|
39
|
-
desc
|
|
41
|
+
desc 'Run all RSpec tests'
|
|
40
42
|
task :full_spec do
|
|
41
43
|
warn 'starting spec'
|
|
42
44
|
sh 'TEST_COVERAGE_COMMAND_NAME=full-new bundle exec rspec' # --profile'
|
|
@@ -66,17 +68,17 @@ rescue StandardError => e
|
|
|
66
68
|
# @sg-ignore Need to add nil check here
|
|
67
69
|
warn "Backtrace:\n#{e.backtrace.join("\n")}"
|
|
68
70
|
warn "output: #{output}"
|
|
69
|
-
puts
|
|
71
|
+
puts 'Flushing'
|
|
70
72
|
$stdout.flush
|
|
71
73
|
raise
|
|
72
74
|
end
|
|
73
75
|
|
|
74
|
-
desc
|
|
76
|
+
desc 'Check PR coverage'
|
|
75
77
|
task :undercover do
|
|
76
|
-
raise
|
|
78
|
+
raise 'Undercover failed' unless undercover.success?
|
|
77
79
|
end
|
|
78
80
|
|
|
79
|
-
desc
|
|
81
|
+
desc 'Branch-focused fast-feedback quality/spec/coverage checks'
|
|
80
82
|
task test: %i[overcommit spec typecheck] do
|
|
81
83
|
# do these in order
|
|
82
84
|
Rake::Task['typecheck_strict'].invoke
|
|
@@ -84,18 +86,18 @@ task test: %i[overcommit spec typecheck] do
|
|
|
84
86
|
Rake::Task['typecheck_alpha'].invoke
|
|
85
87
|
end
|
|
86
88
|
|
|
87
|
-
desc
|
|
89
|
+
desc 'Re-run failed specs. Add --fail-fast in your .rspec-local file if desired.'
|
|
88
90
|
task :spec_failed do
|
|
89
91
|
# allow user to check out any persistent failures while looking for
|
|
90
92
|
# more in the whole test suite
|
|
91
93
|
sh 'TEST_COVERAGE_COMMAND_NAME=next-failure bundle exec rspec --only-failures || true'
|
|
92
94
|
end
|
|
93
95
|
|
|
94
|
-
desc
|
|
96
|
+
desc 'Run undercover and show output without failing the task if it fails'
|
|
95
97
|
task :undercover_no_fail do
|
|
96
98
|
undercover
|
|
97
99
|
rescue StandardError
|
|
98
|
-
puts
|
|
100
|
+
puts 'Undercover failed, but continuing with other tasks.'
|
|
99
101
|
end
|
|
100
102
|
|
|
101
103
|
# @return [void]
|
|
@@ -104,7 +106,7 @@ def simplecov_collate
|
|
|
104
106
|
require 'simplecov-lcov'
|
|
105
107
|
require 'undercover/simplecov_formatter'
|
|
106
108
|
|
|
107
|
-
SimpleCov.collate(Dir[
|
|
109
|
+
SimpleCov.collate(Dir['coverage/{next-failure,full,ad-hoc}/.resultset.json']) do
|
|
108
110
|
cname = 'combined'
|
|
109
111
|
command_name cname
|
|
110
112
|
new_dir = File.join('coverage', cname)
|
|
@@ -119,7 +121,7 @@ def simplecov_collate
|
|
|
119
121
|
])
|
|
120
122
|
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
|
|
121
123
|
end
|
|
122
|
-
puts
|
|
124
|
+
puts 'Simplecov collated results into coverage/combined/.resultset.json'
|
|
123
125
|
rescue StandardError => e
|
|
124
126
|
puts "Simplecov collate failed: #{e.message}"
|
|
125
127
|
ensure
|
|
@@ -131,7 +133,7 @@ task :simplecov_collate do
|
|
|
131
133
|
simplecov_collate
|
|
132
134
|
end
|
|
133
135
|
|
|
134
|
-
desc
|
|
136
|
+
desc 'Show quality checks on this development branch so far, including any staged files'
|
|
135
137
|
task :overcommit do
|
|
136
138
|
# OVERCOMMIT_DEBUG=1 will show more detail
|
|
137
139
|
sh 'SOLARGRAPH_ASSERTS=on bundle exec overcommit --run --diff origin/master'
|
data/bin/solargraph
CHANGED
|
@@ -118,15 +118,15 @@ module Solargraph
|
|
|
118
118
|
# @param k [String]
|
|
119
119
|
# @param v [Set<Pin::Base>]
|
|
120
120
|
set.classify(&:class)
|
|
121
|
-
|
|
121
|
+
.map { |k, v| pin_class_hash[k].concat v.to_a }
|
|
122
122
|
# @param k [String]
|
|
123
123
|
# @param v [Set<Pin::Namespace>]
|
|
124
124
|
set.classify(&:namespace)
|
|
125
|
-
|
|
125
|
+
.map { |k, v| namespace_hash[k].concat v.to_a }
|
|
126
126
|
# @param k [String]
|
|
127
127
|
# @param v [Set<Pin::Base>]
|
|
128
128
|
set.classify(&:path)
|
|
129
|
-
|
|
129
|
+
.map { |k, v| path_pin_hash[k].concat v.to_a }
|
|
130
130
|
@namespaces = path_pin_hash.keys.compact.to_set
|
|
131
131
|
map_references Pin::Reference::Include, include_references
|
|
132
132
|
map_references Pin::Reference::Prepend, prepend_references
|
|
@@ -157,20 +157,14 @@ module Solargraph
|
|
|
157
157
|
pins = path_pin_hash[ovr.name]
|
|
158
158
|
logger.debug { "ApiMap::Index#map_overrides: pins for path=#{ovr.name}: #{pins}" }
|
|
159
159
|
pins.each do |pin|
|
|
160
|
-
new_pin = if pin.path.end_with?('#initialize')
|
|
161
|
-
path_pin_hash[pin.path.sub(/#initialize/, '.new')].first
|
|
162
|
-
end
|
|
160
|
+
new_pin = (path_pin_hash[pin.path.sub('#initialize', '.new')].first if pin.path.end_with?('#initialize'))
|
|
163
161
|
(ovr.tags.map(&:tag_name) + ovr.delete).uniq.each do |tag|
|
|
164
162
|
# @sg-ignore Wrong argument type for
|
|
165
163
|
# YARD::Docstring#delete_tags: name expected String,
|
|
166
164
|
# received String, Symbol - delete_tags is ok with a
|
|
167
165
|
# _ToS, but we should fix anyway
|
|
168
166
|
pin.docstring.delete_tags tag
|
|
169
|
-
|
|
170
|
-
# YARD::Docstring#delete_tags: name expected String,
|
|
171
|
-
# received String, Symbol - delete_tags is ok with a
|
|
172
|
-
# _ToS, but we should fix anyway
|
|
173
|
-
new_pin.docstring.delete_tags tag if new_pin
|
|
167
|
+
new_pin&.docstring&.delete_tags tag
|
|
174
168
|
end
|
|
175
169
|
ovr.tags.each do |tag|
|
|
176
170
|
pin.docstring.add_tag(tag)
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Solargraph
|
|
4
4
|
class ApiMap
|
|
5
5
|
module SourceToYard
|
|
6
|
-
|
|
7
6
|
# Get the YARD CodeObject at the specified path.
|
|
8
7
|
#
|
|
9
8
|
# @sg-ignore Declared return type generic<T>, nil does not match
|
|
@@ -15,7 +14,7 @@ module Solargraph
|
|
|
15
14
|
# @return [generic<T>, nil]
|
|
16
15
|
def code_object_at path, klass = YARD::CodeObjects::Base
|
|
17
16
|
obj = code_object_map[path]
|
|
18
|
-
obj if obj
|
|
17
|
+
obj if obj.is_a?(klass)
|
|
19
18
|
end
|
|
20
19
|
|
|
21
20
|
# @return [Array<String>]
|
|
@@ -36,20 +35,20 @@ module Solargraph
|
|
|
36
35
|
end
|
|
37
36
|
if pin.type == :class
|
|
38
37
|
# @param obj [YARD::CodeObjects::RootObject]
|
|
39
|
-
code_object_map[pin.path] ||= YARD::CodeObjects::ClassObject.new(root_code_object, pin.path)
|
|
38
|
+
code_object_map[pin.path] ||= YARD::CodeObjects::ClassObject.new(root_code_object, pin.path) do |obj|
|
|
40
39
|
# @sg-ignore flow sensitive typing needs to handle attrs
|
|
41
40
|
next if pin.location.nil? || pin.location.filename.nil?
|
|
42
41
|
# @sg-ignore flow sensitive typing needs to handle attrs
|
|
43
42
|
obj.add_file(pin.location.filename, pin.location.range.start.line, !pin.comments.empty?)
|
|
44
|
-
|
|
43
|
+
end
|
|
45
44
|
else
|
|
46
45
|
# @param obj [YARD::CodeObjects::RootObject]
|
|
47
|
-
code_object_map[pin.path] ||= YARD::CodeObjects::ModuleObject.new(root_code_object, pin.path)
|
|
46
|
+
code_object_map[pin.path] ||= YARD::CodeObjects::ModuleObject.new(root_code_object, pin.path) do |obj|
|
|
48
47
|
# @sg-ignore flow sensitive typing needs to handle attrs
|
|
49
48
|
next if pin.location.nil? || pin.location.filename.nil?
|
|
50
49
|
# @sg-ignore flow sensitive typing needs to handle attrs
|
|
51
50
|
obj.add_file(pin.location.filename, pin.location.range.start.line, !pin.comments.empty?)
|
|
52
|
-
|
|
51
|
+
end
|
|
53
52
|
end
|
|
54
53
|
code_object_map[pin.path].docstring = pin.docstring
|
|
55
54
|
store.get_includes(pin.path).each do |ref|
|
|
@@ -75,12 +74,14 @@ module Solargraph
|
|
|
75
74
|
|
|
76
75
|
# @sg-ignore Need to add nil check here
|
|
77
76
|
# @param obj [YARD::CodeObjects::RootObject]
|
|
78
|
-
code_object_map[pin.path] ||= YARD::CodeObjects::MethodObject.new(
|
|
77
|
+
code_object_map[pin.path] ||= YARD::CodeObjects::MethodObject.new(
|
|
78
|
+
code_object_at(pin.namespace, YARD::CodeObjects::NamespaceObject), pin.name, pin.scope
|
|
79
|
+
) do |obj|
|
|
79
80
|
# @sg-ignore flow sensitive typing needs to handle attrs
|
|
80
81
|
next if pin.location.nil? || pin.location.filename.nil?
|
|
81
82
|
# @sg-ignore flow sensitive typing needs to handle attrs
|
|
82
83
|
obj.add_file pin.location.filename, pin.location.range.start.line
|
|
83
|
-
|
|
84
|
+
end
|
|
84
85
|
method_object = code_object_at(pin.path, YARD::CodeObjects::MethodObject)
|
|
85
86
|
# @sg-ignore Need to add nil check here
|
|
86
87
|
method_object.docstring = pin.docstring
|
|
@@ -32,16 +32,16 @@ module Solargraph
|
|
|
32
32
|
|
|
33
33
|
# @todo Fix this map
|
|
34
34
|
@fqns_pins_map = nil
|
|
35
|
-
return catalog(pinsets) if changed
|
|
35
|
+
return catalog(pinsets) if changed.zero?
|
|
36
36
|
|
|
37
37
|
# @sg-ignore Need to add nil check here
|
|
38
38
|
pinsets[changed..].each_with_index do |pins, idx|
|
|
39
39
|
@pinsets[changed + idx] = pins
|
|
40
40
|
@indexes[changed + idx] = if pins.empty?
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
@indexes[changed + idx - 1]
|
|
42
|
+
else
|
|
43
|
+
@indexes[changed + idx - 1].merge(pins)
|
|
44
|
+
end
|
|
45
45
|
end
|
|
46
46
|
constants.clear
|
|
47
47
|
cached_qualify_superclass.clear
|
|
@@ -60,10 +60,10 @@ module Solargraph
|
|
|
60
60
|
# @param visibility [Array<Symbol>]
|
|
61
61
|
# @return [Enumerable<Solargraph::Pin::Namespace, Solargraph::Pin::Constant>]
|
|
62
62
|
def get_constants fqns, visibility = [:public]
|
|
63
|
-
namespace_children(fqns).select
|
|
63
|
+
namespace_children(fqns).select do |pin|
|
|
64
64
|
# @sg-ignore flow sensitive typing not smart enough to handle this case
|
|
65
65
|
!pin.name.empty? && (pin.is_a?(Pin::Namespace) || pin.is_a?(Pin::Constant)) && visibility.include?(pin.visibility)
|
|
66
|
-
|
|
66
|
+
end
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
# @param fqns [String]
|
|
@@ -77,8 +77,10 @@ module Solargraph
|
|
|
77
77
|
GemPins.combine_method_pins_by_path(all_pins)
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
-
BOOLEAN_SUPERCLASS_PIN = Pin::Reference::Superclass.new(name: 'Boolean', closure: Pin::ROOT_PIN,
|
|
81
|
-
|
|
80
|
+
BOOLEAN_SUPERCLASS_PIN = Pin::Reference::Superclass.new(name: 'Boolean', closure: Pin::ROOT_PIN,
|
|
81
|
+
source: :solargraph)
|
|
82
|
+
OBJECT_SUPERCLASS_PIN = Pin::Reference::Superclass.new(name: 'Object', closure: Pin::ROOT_PIN,
|
|
83
|
+
source: :solargraph)
|
|
82
84
|
|
|
83
85
|
# @param fqns [String, nil]
|
|
84
86
|
# @return [Pin::Reference::Superclass, nil]
|
|
@@ -129,17 +131,17 @@ module Solargraph
|
|
|
129
131
|
# @param fqns [String, nil]
|
|
130
132
|
# @param scope [Symbol] :class or :instance
|
|
131
133
|
# @return [Enumerable<Solargraph::Pin::Base>]
|
|
132
|
-
def get_instance_variables
|
|
133
|
-
all_instance_variables.select
|
|
134
|
+
def get_instance_variables fqns, scope = :instance
|
|
135
|
+
all_instance_variables.select do |pin|
|
|
134
136
|
pin.binder.namespace == fqns && pin.binder.scope == scope
|
|
135
|
-
|
|
137
|
+
end
|
|
136
138
|
end
|
|
137
139
|
|
|
138
140
|
# @param fqns [String]
|
|
139
141
|
#
|
|
140
142
|
# @return [Enumerable<Solargraph::Pin::ClassVariable>]
|
|
141
|
-
def get_class_variables
|
|
142
|
-
namespace_children(fqns).select { |pin| pin.is_a?(Pin::ClassVariable)}
|
|
143
|
+
def get_class_variables fqns
|
|
144
|
+
namespace_children(fqns).select { |pin| pin.is_a?(Pin::ClassVariable) }
|
|
143
145
|
end
|
|
144
146
|
|
|
145
147
|
# @return [Enumerable<Solargraph::Pin::Base>]
|
|
@@ -149,7 +151,7 @@ module Solargraph
|
|
|
149
151
|
|
|
150
152
|
# @param fqns [String]
|
|
151
153
|
# @return [Boolean]
|
|
152
|
-
def namespace_exists?
|
|
154
|
+
def namespace_exists? fqns
|
|
153
155
|
fqns_pins(fqns).any?
|
|
154
156
|
end
|
|
155
157
|
|
|
@@ -165,7 +167,7 @@ module Solargraph
|
|
|
165
167
|
|
|
166
168
|
# @param fqns [String]
|
|
167
169
|
# @return [Array<String>]
|
|
168
|
-
def domains
|
|
170
|
+
def domains fqns
|
|
169
171
|
result = []
|
|
170
172
|
fqns_pins(fqns).each do |nspin|
|
|
171
173
|
result.concat nspin.domains
|
|
@@ -178,7 +180,7 @@ module Solargraph
|
|
|
178
180
|
@named_macros ||= begin
|
|
179
181
|
result = {}
|
|
180
182
|
pins.each do |pin|
|
|
181
|
-
pin.macros.select{|m| m.tag.tag_name == 'macro' && !m.tag.text.empty? }.each do |macro|
|
|
183
|
+
pin.macros.select { |m| m.tag.tag_name == 'macro' && !m.tag.text.empty? }.each do |macro|
|
|
182
184
|
next if macro.tag.name.nil? || macro.tag.name.empty?
|
|
183
185
|
result[macro.tag.name] = macro
|
|
184
186
|
end
|
|
@@ -217,7 +219,7 @@ module Solargraph
|
|
|
217
219
|
# Get all ancestors (superclasses, includes, prepends, extends) for a namespace
|
|
218
220
|
# @param fqns [String] The fully qualified namespace
|
|
219
221
|
# @return [Array<String>] Array of ancestor namespaces including the original
|
|
220
|
-
def get_ancestors
|
|
222
|
+
def get_ancestors fqns
|
|
221
223
|
return [] if fqns.nil? || fqns.empty?
|
|
222
224
|
|
|
223
225
|
ancestors = [fqns]
|
|
@@ -260,7 +262,7 @@ module Solargraph
|
|
|
260
262
|
# @param fqns [String]
|
|
261
263
|
#
|
|
262
264
|
# @return [Array<Solargraph::Pin::Reference>]
|
|
263
|
-
def get_ancestor_references
|
|
265
|
+
def get_ancestor_references fqns
|
|
264
266
|
(get_prepends(fqns) + get_includes(fqns) + [get_superclass(fqns)]).compact
|
|
265
267
|
end
|
|
266
268
|
|
|
@@ -350,7 +352,7 @@ module Solargraph
|
|
|
350
352
|
|
|
351
353
|
# @param fqns [String]
|
|
352
354
|
# @return [Pin::Reference::Superclass, nil]
|
|
353
|
-
def try_special_superclasses
|
|
355
|
+
def try_special_superclasses fqns
|
|
354
356
|
return OBJECT_SUPERCLASS_PIN if fqns == 'Boolean'
|
|
355
357
|
return OBJECT_SUPERCLASS_PIN if !%w[BasicObject Object].include?(fqns) && namespace_exists?(fqns)
|
|
356
358
|
|
data/lib/solargraph/api_map.rb
CHANGED
|
@@ -51,15 +51,15 @@ module Solargraph
|
|
|
51
51
|
#
|
|
52
52
|
|
|
53
53
|
# @param other [Object]
|
|
54
|
-
def eql?
|
|
54
|
+
def eql? other
|
|
55
55
|
self.class == other.class &&
|
|
56
56
|
# @sg-ignore flow sensitive typing needs to handle self.class == other.class
|
|
57
57
|
equality_fields == other.equality_fields
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
# @param other [Object]
|
|
61
|
-
def ==
|
|
62
|
-
|
|
61
|
+
def == other
|
|
62
|
+
eql?(other)
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
# @return [Integer]
|
|
@@ -127,13 +127,6 @@ module Solargraph
|
|
|
127
127
|
self
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
-
# @todo need to model type def statement in chains as a symbol so
|
|
131
|
-
# that this overload of 'protected' will typecheck @sg-ignore
|
|
132
|
-
# @sg-ignore
|
|
133
|
-
protected def equality_fields
|
|
134
|
-
[self.class, @source_map_hash, conventions_environ, @doc_map, @unresolved_requires, @missing_docs, @loose_unions]
|
|
135
|
-
end
|
|
136
|
-
|
|
137
130
|
# @return [DocMap]
|
|
138
131
|
def doc_map
|
|
139
132
|
@doc_map ||= DocMap.new([], Workspace.new('.'))
|
|
@@ -212,7 +205,7 @@ module Solargraph
|
|
|
212
205
|
# @param rebuild [Boolean]
|
|
213
206
|
# @param out [StringIO, IO, nil]
|
|
214
207
|
# @return [void]
|
|
215
|
-
def cache_gem
|
|
208
|
+
def cache_gem gemspec, rebuild: false, out: nil
|
|
216
209
|
doc_map.cache(gemspec, rebuild: rebuild, out: out)
|
|
217
210
|
end
|
|
218
211
|
|
|
@@ -317,19 +310,19 @@ module Solargraph
|
|
|
317
310
|
#
|
|
318
311
|
# @param pin [Pin::Reference]
|
|
319
312
|
# @return [String, nil]
|
|
320
|
-
def dereference
|
|
313
|
+
def dereference pin
|
|
321
314
|
store.constants.dereference(pin)
|
|
322
315
|
end
|
|
323
316
|
|
|
324
317
|
# @param fqns [String]
|
|
325
318
|
# @return [Array<Pin::Reference::Extend>]
|
|
326
|
-
def get_extends
|
|
319
|
+
def get_extends fqns
|
|
327
320
|
store.get_extends(fqns)
|
|
328
321
|
end
|
|
329
322
|
|
|
330
323
|
# @param fqns [String]
|
|
331
324
|
# @return [Array<Pin::Reference::Include>]
|
|
332
|
-
def get_includes
|
|
325
|
+
def get_includes fqns
|
|
333
326
|
store.get_includes(fqns)
|
|
334
327
|
end
|
|
335
328
|
|
|
@@ -341,7 +334,7 @@ module Solargraph
|
|
|
341
334
|
# @return [Array<Solargraph::Pin::InstanceVariable>]
|
|
342
335
|
def get_instance_variable_pins namespace, scope = :instance
|
|
343
336
|
result = []
|
|
344
|
-
|
|
337
|
+
[namespace]
|
|
345
338
|
result.concat store.get_instance_variables(namespace, scope)
|
|
346
339
|
sc_fqns = namespace
|
|
347
340
|
while (sc = store.get_superclass(sc_fqns))
|
|
@@ -364,12 +357,12 @@ module Solargraph
|
|
|
364
357
|
# @param location [Location]
|
|
365
358
|
#
|
|
366
359
|
# @return [Pin::BaseVariable, nil]
|
|
367
|
-
def var_at_location
|
|
368
|
-
with_correct_name = candidates.select { |pin| pin.name == name}
|
|
360
|
+
def var_at_location candidates, name, closure, location
|
|
361
|
+
with_correct_name = candidates.select { |pin| pin.name == name }
|
|
369
362
|
vars_at_location = with_correct_name.reject do |pin|
|
|
370
363
|
# visible_at? excludes the starting position, but we want to
|
|
371
364
|
# include it for this purpose
|
|
372
|
-
|
|
365
|
+
!pin.visible_at?(closure, location) && !pin.starts_at?(location)
|
|
373
366
|
end
|
|
374
367
|
|
|
375
368
|
vars_at_location.inject(&:combine_with)
|
|
@@ -446,7 +439,7 @@ module Solargraph
|
|
|
446
439
|
comments: init_pin.comments,
|
|
447
440
|
closure: init_pin.closure,
|
|
448
441
|
source: init_pin.source,
|
|
449
|
-
type_location: init_pin.type_location
|
|
442
|
+
type_location: init_pin.type_location
|
|
450
443
|
)
|
|
451
444
|
new_pin.parameters = init_pin.parameters.map do |init_param|
|
|
452
445
|
param = init_param.clone
|
|
@@ -505,7 +498,7 @@ module Solargraph
|
|
|
505
498
|
result = Set.new
|
|
506
499
|
complex_type.each do |type|
|
|
507
500
|
if type.duck_type?
|
|
508
|
-
result.add Pin::DuckMethod.new(name: type.to_s[1
|
|
501
|
+
result.add Pin::DuckMethod.new(name: type.to_s[1..], source: :api_map)
|
|
509
502
|
result.merge get_methods('Object')
|
|
510
503
|
else
|
|
511
504
|
unless type.nil? || type.name == 'void'
|
|
@@ -536,7 +529,8 @@ module Solargraph
|
|
|
536
529
|
# @param preserve_generics [Boolean] True to preserve any
|
|
537
530
|
# unresolved generic parameters, false to erase them
|
|
538
531
|
# @return [Array<Solargraph::Pin::Method>]
|
|
539
|
-
def get_method_stack rooted_tag, name, scope: :instance, visibility: [
|
|
532
|
+
def get_method_stack rooted_tag, name, scope: :instance, visibility: %i[private protected public],
|
|
533
|
+
preserve_generics: false
|
|
540
534
|
rooted_type = ComplexType.parse(rooted_tag)
|
|
541
535
|
fqns = rooted_type.namespace
|
|
542
536
|
namespace_pin = store.get_path_pins(fqns).first
|
|
@@ -661,7 +655,7 @@ module Solargraph
|
|
|
661
655
|
# @param sup [String] The superclass
|
|
662
656
|
# @param sub [String] The subclass
|
|
663
657
|
# @return [Boolean]
|
|
664
|
-
def super_and_sub?
|
|
658
|
+
def super_and_sub? sup, sub
|
|
665
659
|
sup = ComplexType.try_parse(sup)
|
|
666
660
|
sub = ComplexType.try_parse(sub)
|
|
667
661
|
# @todo If two literals are different values of the same type, it would
|
|
@@ -693,14 +687,14 @@ module Solargraph
|
|
|
693
687
|
# @param module_ns [String] The module namespace (no type parameters)
|
|
694
688
|
#
|
|
695
689
|
# @return [Boolean]
|
|
696
|
-
def type_include?
|
|
690
|
+
def type_include? host_ns, module_ns
|
|
697
691
|
store.get_includes(host_ns).map { |inc_tag| inc_tag.type.name }.include?(module_ns)
|
|
698
692
|
end
|
|
699
693
|
|
|
700
694
|
# @param pins [Enumerable<Pin::Base>]
|
|
701
695
|
# @param visibility [Enumerable<Symbol>]
|
|
702
696
|
# @return [Array<Pin::Base>]
|
|
703
|
-
def resolve_method_aliases pins, visibility = [
|
|
697
|
+
def resolve_method_aliases pins, visibility = %i[public private protected]
|
|
704
698
|
with_resolved_aliases = pins.map do |pin|
|
|
705
699
|
next pin unless pin.is_a?(Pin::MethodAlias)
|
|
706
700
|
resolved = resolve_method_alias(pin)
|
|
@@ -730,7 +724,7 @@ module Solargraph
|
|
|
730
724
|
# @param skip [Set<String>]
|
|
731
725
|
# @param no_core [Boolean] Skip core classes if true
|
|
732
726
|
# @return [Array<Pin::Base>]
|
|
733
|
-
def inner_get_methods_from_reference
|
|
727
|
+
def inner_get_methods_from_reference fq_reference_tag, namespace_pin, type, scope, visibility, deep, skip, no_core
|
|
734
728
|
logger.debug { "ApiMap#add_methods_from_reference(type=#{type}) starting" }
|
|
735
729
|
|
|
736
730
|
# Ensure the types returned by the methods in the referenced
|
|
@@ -786,7 +780,7 @@ module Solargraph
|
|
|
786
780
|
def inner_get_methods rooted_tag, scope, visibility, deep, skip, no_core = false
|
|
787
781
|
rooted_type = ComplexType.parse(rooted_tag).force_rooted
|
|
788
782
|
fqns = rooted_type.namespace
|
|
789
|
-
|
|
783
|
+
rooted_type.all_params
|
|
790
784
|
namespace_pin = store.get_path_pins(fqns).select { |p| p.is_a?(Pin::Namespace) }.first
|
|
791
785
|
return [] if no_core && fqns =~ /^(Object|BasicObject|Class|Module)$/
|
|
792
786
|
reqstr = "#{fqns}|#{scope}|#{visibility.sort}|#{deep}"
|
|
@@ -797,7 +791,9 @@ module Solargraph
|
|
|
797
791
|
# ensure we start out with any immediate methods in this
|
|
798
792
|
# namespace so we roughly match the same ordering of get_methods
|
|
799
793
|
# and obey the 'deep' instruction
|
|
800
|
-
direct_convention_methods, convention_methods_by_reference = environ.pins.partition
|
|
794
|
+
direct_convention_methods, convention_methods_by_reference = environ.pins.partition do |p|
|
|
795
|
+
p.namespace == rooted_tag
|
|
796
|
+
end
|
|
801
797
|
result.concat direct_convention_methods
|
|
802
798
|
|
|
803
799
|
if deep && scope == :instance
|
|
@@ -809,8 +805,10 @@ module Solargraph
|
|
|
809
805
|
# Store#get_methods doesn't know about full tags, just
|
|
810
806
|
# namespaces; resolving the generics in the method pins is this
|
|
811
807
|
# class' responsibility
|
|
812
|
-
methods = store.get_methods(fqns, scope: scope, visibility: visibility).sort{ |a, b| a.name <=> b.name }
|
|
813
|
-
logger.info
|
|
808
|
+
methods = store.get_methods(fqns, scope: scope, visibility: visibility).sort { |a, b| a.name <=> b.name }
|
|
809
|
+
logger.info do
|
|
810
|
+
"ApiMap#inner_get_methods(rooted_tag=#{rooted_tag.inspect}, scope=#{scope.inspect}, visibility=#{visibility.inspect}, deep=#{deep.inspect}, skip=#{skip.inspect}, fqns=#{fqns}) - added from store: #{methods}"
|
|
811
|
+
end
|
|
814
812
|
result.concat methods
|
|
815
813
|
if deep
|
|
816
814
|
result.concat convention_methods_by_reference
|
|
@@ -819,7 +817,8 @@ module Solargraph
|
|
|
819
817
|
store.get_includes(fqns).reverse.each do |ref|
|
|
820
818
|
in_tag = dereference(ref)
|
|
821
819
|
# @sg-ignore Need to add nil check here
|
|
822
|
-
result.concat inner_get_methods_from_reference(in_tag, namespace_pin, rooted_type, scope, visibility, deep,
|
|
820
|
+
result.concat inner_get_methods_from_reference(in_tag, namespace_pin, rooted_type, scope, visibility, deep,
|
|
821
|
+
skip, true)
|
|
823
822
|
end
|
|
824
823
|
rooted_sc_tag = qualify_superclass(rooted_tag)
|
|
825
824
|
unless rooted_sc_tag.nil?
|
|
@@ -827,7 +826,9 @@ module Solargraph
|
|
|
827
826
|
visibility, true, skip, no_core)
|
|
828
827
|
end
|
|
829
828
|
else
|
|
830
|
-
logger.info
|
|
829
|
+
logger.info do
|
|
830
|
+
"ApiMap#inner_get_methods(#{fqns}, #{scope}, #{visibility}, #{deep}, #{skip}) - looking for get_extends() from #{fqns}"
|
|
831
|
+
end
|
|
831
832
|
store.get_extends(fqns).reverse.each do |em|
|
|
832
833
|
fqem = dereference(em)
|
|
833
834
|
result.concat inner_get_methods(fqem, :instance, visibility, deep, skip, true) unless fqem.nil?
|
|
@@ -863,7 +864,7 @@ module Solargraph
|
|
|
863
864
|
def get_namespace_type fqns
|
|
864
865
|
return nil if fqns.nil?
|
|
865
866
|
# @type [Pin::Namespace, nil]
|
|
866
|
-
pin = store.get_path_pins(fqns).select{|p| p.is_a?(Pin::Namespace)}.first
|
|
867
|
+
pin = store.get_path_pins(fqns).select { |p| p.is_a?(Pin::Namespace) }.first
|
|
867
868
|
return nil if pin.nil?
|
|
868
869
|
pin.type
|
|
869
870
|
end
|
|
@@ -889,7 +890,7 @@ module Solargraph
|
|
|
889
890
|
|
|
890
891
|
# @param alias_pin [Pin::MethodAlias]
|
|
891
892
|
# @return [Pin::Method, nil]
|
|
892
|
-
def resolve_method_alias
|
|
893
|
+
def resolve_method_alias alias_pin
|
|
893
894
|
ancestors = store.get_ancestors(alias_pin.full_context.reduce_class_type.tag)
|
|
894
895
|
# @type [Pin::Method, nil]
|
|
895
896
|
original = nil
|
|
@@ -920,7 +921,9 @@ module Solargraph
|
|
|
920
921
|
end
|
|
921
922
|
if original.nil?
|
|
922
923
|
# :nocov:
|
|
923
|
-
Solargraph.assert_or_log(:alias_target_missing)
|
|
924
|
+
Solargraph.assert_or_log(:alias_target_missing) do
|
|
925
|
+
"Rejecting alias - target is missing while looking for #{alias_pin.full_context.tag} #{alias_pin.original} in #{alias_pin.scope} scope = #{alias_pin.inspect}"
|
|
926
|
+
end
|
|
924
927
|
return nil
|
|
925
928
|
# :nocov:
|
|
926
929
|
end
|
|
@@ -933,7 +936,7 @@ module Solargraph
|
|
|
933
936
|
# @param alias_pin [Pin::MethodAlias] The alias pin to resolve
|
|
934
937
|
# @param original [Pin::Method] The original method pin that was already found
|
|
935
938
|
# @return [Pin::Method] The resolved method pin
|
|
936
|
-
def create_resolved_alias_pin
|
|
939
|
+
def create_resolved_alias_pin alias_pin, original
|
|
937
940
|
# Build the resolved method pin directly (same logic as resolve_method_alias but without lookup)
|
|
938
941
|
args = {
|
|
939
942
|
location: alias_pin.location,
|
|
@@ -949,7 +952,7 @@ module Solargraph
|
|
|
949
952
|
return_type: original.return_type,
|
|
950
953
|
source: :resolve_method_alias
|
|
951
954
|
}
|
|
952
|
-
resolved_pin = Pin::Method.new
|
|
955
|
+
resolved_pin = Pin::Method.new(**args)
|
|
953
956
|
|
|
954
957
|
# Clone signatures and parameters
|
|
955
958
|
resolved_pin.signatures.each do |sig|
|
|
@@ -987,7 +990,7 @@ module Solargraph
|
|
|
987
990
|
end
|
|
988
991
|
|
|
989
992
|
# @param namespace_pin [Pin::Namespace, Pin::Constant]
|
|
990
|
-
def has_generics?
|
|
993
|
+
def has_generics? namespace_pin
|
|
991
994
|
namespace_pin.is_a?(Pin::Namespace) && !namespace_pin.generics.empty?
|
|
992
995
|
end
|
|
993
996
|
|
|
@@ -996,5 +999,15 @@ module Solargraph
|
|
|
996
999
|
def can_resolve_generics? namespace_pin, rooted_type
|
|
997
1000
|
has_generics?(namespace_pin) && !rooted_type.all_params.empty?
|
|
998
1001
|
end
|
|
1002
|
+
|
|
1003
|
+
protected
|
|
1004
|
+
|
|
1005
|
+
# @todo need to model type def statement in chains as a symbol so
|
|
1006
|
+
# that this overload of 'protected' will typecheck @sg-ignore
|
|
1007
|
+
# @sg-ignore
|
|
1008
|
+
def equality_fields
|
|
1009
|
+
[self.class, @source_map_hash, conventions_environ, @doc_map, @unresolved_requires, @missing_docs,
|
|
1010
|
+
@loose_unions]
|
|
1011
|
+
end
|
|
999
1012
|
end
|
|
1000
1013
|
end
|