steep 0.16.0 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +0 -3
- data/CHANGELOG.md +24 -0
- data/Rakefile +0 -13
- data/bin/setup +0 -2
- data/bin/smoke_runner.rb +0 -1
- data/exe/steep +0 -1
- data/lib/steep.rb +1 -1
- data/lib/steep/drivers/check.rb +1 -12
- data/lib/steep/drivers/watch.rb +2 -2
- data/lib/steep/project/file.rb +1 -1
- data/lib/steep/project/hover_content.rb +1 -1
- data/lib/steep/project/options.rb +15 -0
- data/lib/steep/server/code_worker.rb +4 -4
- data/lib/steep/server/signature_worker.rb +4 -4
- data/lib/steep/type_construction.rb +13 -19
- data/lib/steep/type_inference/constant_env.rb +2 -10
- data/lib/steep/type_inference/context.rb +1 -0
- data/lib/steep/version.rb +1 -1
- data/steep.gemspec +6 -7
- metadata +23 -146
- data/exe/rbs +0 -3
- data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
- data/vendor/ruby-signature/.gitignore +0 -12
- data/vendor/ruby-signature/.rubocop.yml +0 -15
- data/vendor/ruby-signature/BSDL +0 -22
- data/vendor/ruby-signature/COPYING +0 -56
- data/vendor/ruby-signature/Gemfile +0 -6
- data/vendor/ruby-signature/README.md +0 -93
- data/vendor/ruby-signature/Rakefile +0 -142
- data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -157
- data/vendor/ruby-signature/bin/console +0 -14
- data/vendor/ruby-signature/bin/query-rdoc +0 -103
- data/vendor/ruby-signature/bin/setup +0 -10
- data/vendor/ruby-signature/bin/sort +0 -89
- data/vendor/ruby-signature/bin/test_runner.rb +0 -16
- data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
- data/vendor/ruby-signature/docs/sigs.md +0 -148
- data/vendor/ruby-signature/docs/stdlib.md +0 -152
- data/vendor/ruby-signature/docs/syntax.md +0 -528
- data/vendor/ruby-signature/exe/rbs +0 -7
- data/vendor/ruby-signature/lib/rbs.rb +0 -64
- data/vendor/ruby-signature/lib/rbs/ast/annotation.rb +0 -27
- data/vendor/ruby-signature/lib/rbs/ast/comment.rb +0 -27
- data/vendor/ruby-signature/lib/rbs/ast/declarations.rb +0 -395
- data/vendor/ruby-signature/lib/rbs/ast/members.rb +0 -362
- data/vendor/ruby-signature/lib/rbs/buffer.rb +0 -50
- data/vendor/ruby-signature/lib/rbs/builtin_names.rb +0 -55
- data/vendor/ruby-signature/lib/rbs/cli.rb +0 -558
- data/vendor/ruby-signature/lib/rbs/constant.rb +0 -26
- data/vendor/ruby-signature/lib/rbs/constant_table.rb +0 -150
- data/vendor/ruby-signature/lib/rbs/definition.rb +0 -170
- data/vendor/ruby-signature/lib/rbs/definition_builder.rb +0 -919
- data/vendor/ruby-signature/lib/rbs/environment.rb +0 -281
- data/vendor/ruby-signature/lib/rbs/environment_loader.rb +0 -136
- data/vendor/ruby-signature/lib/rbs/environment_walker.rb +0 -124
- data/vendor/ruby-signature/lib/rbs/errors.rb +0 -187
- data/vendor/ruby-signature/lib/rbs/location.rb +0 -102
- data/vendor/ruby-signature/lib/rbs/method_type.rb +0 -123
- data/vendor/ruby-signature/lib/rbs/namespace.rb +0 -91
- data/vendor/ruby-signature/lib/rbs/parser.y +0 -1344
- data/vendor/ruby-signature/lib/rbs/prototype/rb.rb +0 -553
- data/vendor/ruby-signature/lib/rbs/prototype/rbi.rb +0 -587
- data/vendor/ruby-signature/lib/rbs/prototype/runtime.rb +0 -381
- data/vendor/ruby-signature/lib/rbs/substitution.rb +0 -46
- data/vendor/ruby-signature/lib/rbs/test.rb +0 -26
- data/vendor/ruby-signature/lib/rbs/test/errors.rb +0 -61
- data/vendor/ruby-signature/lib/rbs/test/hook.rb +0 -294
- data/vendor/ruby-signature/lib/rbs/test/setup.rb +0 -58
- data/vendor/ruby-signature/lib/rbs/test/spy.rb +0 -325
- data/vendor/ruby-signature/lib/rbs/test/test_helper.rb +0 -183
- data/vendor/ruby-signature/lib/rbs/test/type_check.rb +0 -254
- data/vendor/ruby-signature/lib/rbs/type_name.rb +0 -70
- data/vendor/ruby-signature/lib/rbs/types.rb +0 -936
- data/vendor/ruby-signature/lib/rbs/variance_calculator.rb +0 -138
- data/vendor/ruby-signature/lib/rbs/vendorer.rb +0 -47
- data/vendor/ruby-signature/lib/rbs/version.rb +0 -3
- data/vendor/ruby-signature/lib/rbs/writer.rb +0 -269
- data/vendor/ruby-signature/lib/ruby/signature.rb +0 -7
- data/vendor/ruby-signature/rbs.gemspec +0 -46
- data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -60
- data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -71
- data/vendor/ruby-signature/stdlib/benchmark/benchmark.rbs +0 -372
- data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
- data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
- data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
- data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -45
- data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
- data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
- data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
- data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
- data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
- data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
- data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -413
- data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -607
- data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
- data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
- data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
- data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
- data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -194
- data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
- data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
- data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -1076
- data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
- data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
- data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -243
- data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
- data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -707
- data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
- data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -576
- data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -161
- data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -271
- data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -369
- data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -185
- data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -1104
- data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
- data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
- data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
- data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -429
- data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -1227
- data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -267
- data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
- data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
- data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -57
- data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -1083
- data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
- data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
- data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -1901
- data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -284
- data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -228
- data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1108
- data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
- data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -1047
- data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -290
- data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
- data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -153
- data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
- data/vendor/ruby-signature/stdlib/coverage/coverage.rbs +0 -62
- data/vendor/ruby-signature/stdlib/csv/csv.rbs +0 -773
- data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -392
- data/vendor/ruby-signature/stdlib/find/find.rbs +0 -40
- data/vendor/ruby-signature/stdlib/ipaddr/ipaddr.rbs +0 -247
- data/vendor/ruby-signature/stdlib/json/json.rbs +0 -335
- data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -1093
- data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
- data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
- data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
- data/vendor/ruby-signature/stdlib/set/set.rbs +0 -301
- data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1ad7c49806193ddc567206eff7d74ad184bf6e339f15f5a06b54eac2a44798d
|
4
|
+
data.tar.gz: 7738b5ccd9339e7de6643e8d87b8e3eaf7a0f36a42a4667848ea29cc3637d34a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68c6694af012124101dbf7d345fd4cab56582968a58cb462c4336558547089a403604606991585d12c5165b2955002f5905fe6b75788e7bab677cb9b6229f1ec
|
7
|
+
data.tar.gz: 25437e503f4630e92b9fa7cdb31701ae809209f8e300812736a6acacdd181882fd380d277dd672334ae88698198c5ea4a2e0d7d83761614d75db86cf49d9d49e
|
data/.gitmodules
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,30 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.17.1 (2020-06-15)
|
6
|
+
|
7
|
+
* Allow RBS gem to be 0.4 ([#153](https://github.com/soutaro/steep/pull/153))
|
8
|
+
|
9
|
+
## 0.17.0 (2020-06-13)
|
10
|
+
|
11
|
+
* Fix `steep watch` and `steep langserver` to correctly handle error message filterings based on options ([#152](https://github.com/soutaro/steep/pull/152))
|
12
|
+
* Fix typing of collections ([#151](https://github.com/soutaro/steep/pull/151))
|
13
|
+
|
14
|
+
## 0.16.3
|
15
|
+
|
16
|
+
* Fix `steep watch` ([#147](https://github.com/soutaro/steep/pull/147))
|
17
|
+
* Stop using pry ([#148](https://github.com/soutaro/steep/pull/148))
|
18
|
+
|
19
|
+
## 0.16.2 (2020-05-27)
|
20
|
+
|
21
|
+
* Update gems ([#144](https://github.com/soutaro/steep/pull/144), [#145](https://github.com/soutaro/steep/pull/145))
|
22
|
+
|
23
|
+
## 0.16.1 (2020-05-22)
|
24
|
+
|
25
|
+
* Fix constant resolution ([#143](https://github.com/soutaro/steep/pull/143))
|
26
|
+
* Fix RBS diagnostics line number in LSP ([#142](https://github.com/soutaro/steep/pull/142))
|
27
|
+
* Fix crash caused by hover on `def` in LSP ([#140](https://github.com/soutaro/steep/pull/140))
|
28
|
+
|
5
29
|
## 0.16.0 (2020-05-19)
|
6
30
|
|
7
31
|
* Spawn workers for type check performance ([#137](https://github.com/soutaro/steep/pull/137))
|
data/Rakefile
CHANGED
@@ -8,19 +8,6 @@ Rake::TestTask.new(:test) do |t|
|
|
8
8
|
end
|
9
9
|
|
10
10
|
task :default => :test
|
11
|
-
task :build => :parser
|
12
|
-
task :test => :parser
|
13
|
-
task :install => [:reset, :parser]
|
14
|
-
|
15
|
-
task :parser do
|
16
|
-
Dir.chdir "vendor/ruby-signature" do
|
17
|
-
sh "bundle exec rake parser"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
task :reset do
|
22
|
-
sh "git submodule update -f --init"
|
23
|
-
end
|
24
11
|
|
25
12
|
task :smoke do
|
26
13
|
sh "bundle", "exec", "bin/smoke_runner.rb", *Dir.glob("smoke/*")
|
data/bin/setup
CHANGED
data/bin/smoke_runner.rb
CHANGED
data/exe/steep
CHANGED
data/lib/steep.rb
CHANGED
data/lib/steep/drivers/check.rb
CHANGED
@@ -53,18 +53,7 @@ module Steep
|
|
53
53
|
status.type_check_sources.each do |source_file|
|
54
54
|
case source_file.status
|
55
55
|
when Project::SourceFile::TypeCheckStatus
|
56
|
-
source_file.errors.
|
57
|
-
case
|
58
|
-
when error.is_a?(Errors::FallbackAny)
|
59
|
-
target.options.allow_fallback_any
|
60
|
-
when error.is_a?(Errors::MethodDefinitionMissing)
|
61
|
-
target.options.allow_missing_definitions
|
62
|
-
when error.is_a?(Errors::NoMethod)
|
63
|
-
target.options.allow_unknown_method_calls
|
64
|
-
when error.is_a?(Errors::UnknownConstantAssigned)
|
65
|
-
target.options.allow_unknown_constant_assignment
|
66
|
-
end
|
67
|
-
end.each do |error|
|
56
|
+
source_file.errors.select {|error| target.options.error_to_report?(error) }.each do |error|
|
68
57
|
error.print_to stdout
|
69
58
|
end
|
70
59
|
when Project::SourceFile::TypeCheckErrorStatus
|
data/lib/steep/drivers/watch.rb
CHANGED
@@ -24,7 +24,7 @@ module Steep
|
|
24
24
|
project = load_config()
|
25
25
|
|
26
26
|
loader = Project::FileLoader.new(project: project)
|
27
|
-
loader.load_sources(
|
27
|
+
loader.load_sources(dirs)
|
28
28
|
loader.load_signatures()
|
29
29
|
|
30
30
|
client_read, server_write = IO.pipe
|
@@ -36,7 +36,7 @@ module Steep
|
|
36
36
|
server_reader = LanguageServer::Protocol::Transport::Io::Reader.new(server_read)
|
37
37
|
server_writer = LanguageServer::Protocol::Transport::Io::Writer.new(server_write)
|
38
38
|
|
39
|
-
interaction_worker = Server::
|
39
|
+
interaction_worker = Server::WorkerProcess.spawn_worker(:interaction, name: "interaction", steepfile: project.steepfile_path)
|
40
40
|
signature_worker = Server::WorkerProcess.spawn_worker(:signature, name: "signature", steepfile: project.steepfile_path)
|
41
41
|
code_workers = Server::WorkerProcess.spawn_code_workers(steepfile: project.steepfile_path)
|
42
42
|
|
data/lib/steep/project/file.rb
CHANGED
@@ -42,7 +42,7 @@ module Steep
|
|
42
42
|
|
43
43
|
def self.type_check(source, subtyping:)
|
44
44
|
annotations = source.annotations(block: source.node, factory: subtyping.factory, current_module: AST::Namespace.root)
|
45
|
-
const_env = TypeInference::ConstantEnv.new(factory: subtyping.factory, context:
|
45
|
+
const_env = TypeInference::ConstantEnv.new(factory: subtyping.factory, context: [AST::Namespace.root])
|
46
46
|
type_env = TypeInference::TypeEnv.build(annotations: annotations,
|
47
47
|
subtyping: subtyping,
|
48
48
|
const_env: const_env,
|
@@ -110,7 +110,7 @@ module Steep
|
|
110
110
|
context = status.typing.context_at(line: line, column: column)
|
111
111
|
method_context = context.method_context
|
112
112
|
|
113
|
-
if method_context
|
113
|
+
if method_context && method_context.method
|
114
114
|
DefinitionContent.new(
|
115
115
|
node: node,
|
116
116
|
method_name: method_context.name,
|
@@ -37,6 +37,21 @@ module Steep
|
|
37
37
|
self.allow_unknown_constant_assignment = true
|
38
38
|
self.allow_unknown_method_calls = true
|
39
39
|
end
|
40
|
+
|
41
|
+
def error_to_report?(error)
|
42
|
+
case
|
43
|
+
when error.is_a?(Errors::FallbackAny)
|
44
|
+
!allow_fallback_any
|
45
|
+
when error.is_a?(Errors::MethodDefinitionMissing)
|
46
|
+
!allow_missing_definitions
|
47
|
+
when error.is_a?(Errors::NoMethod)
|
48
|
+
!allow_unknown_method_calls
|
49
|
+
when error.is_a?(Errors::UnknownConstantAssigned)
|
50
|
+
!allow_unknown_constant_assignment
|
51
|
+
else
|
52
|
+
true
|
53
|
+
end
|
54
|
+
end
|
40
55
|
end
|
41
56
|
end
|
42
57
|
end
|
@@ -47,7 +47,7 @@ module Steep
|
|
47
47
|
|
48
48
|
Steep.logger.info "Finished type checking: #{path}@#{target.name}"
|
49
49
|
|
50
|
-
diagnostics = source_diagnostics(source)
|
50
|
+
diagnostics = source_diagnostics(source, target.options)
|
51
51
|
|
52
52
|
writer.write(
|
53
53
|
method: :"textDocument/publishDiagnostics",
|
@@ -58,7 +58,7 @@ module Steep
|
|
58
58
|
)
|
59
59
|
end
|
60
60
|
|
61
|
-
def source_diagnostics(source)
|
61
|
+
def source_diagnostics(source, options)
|
62
62
|
case status = source.status
|
63
63
|
when Project::SourceFile::ParseErrorStatus
|
64
64
|
[]
|
@@ -80,11 +80,11 @@ module Steep
|
|
80
80
|
)
|
81
81
|
]
|
82
82
|
when Project::SourceFile::TypeCheckStatus
|
83
|
-
status.typing.errors.map do |error|
|
83
|
+
status.typing.errors.select {|error| options.error_to_report?(error) }.map do |error|
|
84
84
|
loc = error.location_to_str
|
85
85
|
|
86
86
|
LSP::Interface::Diagnostic.new(
|
87
|
-
message: StringIO.new.tap {|io| error.print_to(io) }.string.gsub(/\A#{loc}: /, "").chomp,
|
87
|
+
message: StringIO.new.tap {|io| error.print_to(io) }.string.gsub(/\A#{Regexp.escape(loc)}: /, "").chomp,
|
88
88
|
severity: LSP::Constant::DiagnosticSeverity::ERROR,
|
89
89
|
range: LSP::Interface::Range.new(
|
90
90
|
start: LSP::Interface::Position.new(
|
@@ -72,11 +72,11 @@ module Steep
|
|
72
72
|
severity: LSP::Constant::DiagnosticSeverity::ERROR,
|
73
73
|
range: LSP::Interface::Range.new(
|
74
74
|
start: LSP::Interface::Position.new(
|
75
|
-
line: location.start_line,
|
75
|
+
line: location.start_line - 1,
|
76
76
|
character: location.start_column,
|
77
77
|
),
|
78
78
|
end: LSP::Interface::Position.new(
|
79
|
-
line: location.end_line,
|
79
|
+
line: location.end_line - 1,
|
80
80
|
character: location.end_column
|
81
81
|
)
|
82
82
|
)
|
@@ -97,11 +97,11 @@ module Steep
|
|
97
97
|
severity: LSP::Constant::DiagnosticSeverity::ERROR,
|
98
98
|
range: LSP::Interface::Range.new(
|
99
99
|
start: LSP::Interface::Position.new(
|
100
|
-
line: error.location.start_line,
|
100
|
+
line: error.location.start_line - 1,
|
101
101
|
character: error.location.start_column,
|
102
102
|
),
|
103
103
|
end: LSP::Interface::Position.new(
|
104
|
-
line: error.location.end_line,
|
104
|
+
line: error.location.end_line - 1,
|
105
105
|
character: error.location.end_column
|
106
106
|
)
|
107
107
|
)
|
@@ -235,6 +235,9 @@ module Steep
|
|
235
235
|
new_module_name = Names::Module.from_node(node.children.first) or raise "Unexpected module name: #{node.children.first}"
|
236
236
|
new_namespace = nested_namespace_for_module(new_module_name)
|
237
237
|
|
238
|
+
const_context = [new_namespace] + self.module_context.const_env.context
|
239
|
+
module_const_env = TypeInference::ConstantEnv.new(factory: checker.factory, context: const_context)
|
240
|
+
|
238
241
|
annots = source.annotations(block: node, factory: checker.factory, current_module: new_namespace)
|
239
242
|
module_type = AST::Builtin::Module.instance_type
|
240
243
|
|
@@ -292,13 +295,6 @@ module Steep
|
|
292
295
|
module_type = annots.module_type
|
293
296
|
end
|
294
297
|
|
295
|
-
const_context = if new_namespace.empty?
|
296
|
-
nil
|
297
|
-
else
|
298
|
-
Names::Module.new(name: new_namespace.path.last, namespace: new_namespace.parent)
|
299
|
-
end
|
300
|
-
module_const_env = TypeInference::ConstantEnv.new(factory: checker.factory, context: const_context)
|
301
|
-
|
302
298
|
module_context_ = TypeInference::Context::ModuleContext.new(
|
303
299
|
instance_type: instance_type,
|
304
300
|
module_type: annots.self_type || module_type,
|
@@ -397,11 +393,7 @@ module Steep
|
|
397
393
|
module_type = annots.module_type
|
398
394
|
end
|
399
395
|
|
400
|
-
const_context =
|
401
|
-
nil
|
402
|
-
else
|
403
|
-
Names::Module.new(name: new_namespace.path.last, namespace: new_namespace.parent)
|
404
|
-
end
|
396
|
+
const_context = [new_namespace] + self.module_context.const_env.context
|
405
397
|
class_const_env = TypeInference::ConstantEnv.new(factory: checker.factory, context: const_context)
|
406
398
|
|
407
399
|
module_context = TypeInference::Context::ModuleContext.new(
|
@@ -1045,10 +1037,10 @@ module Steep
|
|
1045
1037
|
case child.type
|
1046
1038
|
when :pair
|
1047
1039
|
key, value = child.children
|
1048
|
-
key_types << synthesize(key).type.yield_self do |type|
|
1040
|
+
key_types << synthesize(key, hint: key_hint).type.yield_self do |type|
|
1049
1041
|
select_super_type(type, key_hint)
|
1050
1042
|
end
|
1051
|
-
value_types << synthesize(value).type.yield_self do |type|
|
1043
|
+
value_types << synthesize(value, hint: value_hint).type.yield_self do |type|
|
1052
1044
|
select_super_type(type, value_hint)
|
1053
1045
|
end
|
1054
1046
|
when :kwsplat
|
@@ -1128,6 +1120,7 @@ module Steep
|
|
1128
1120
|
|
1129
1121
|
when :const
|
1130
1122
|
const_name = Names::Module.from_node(node)
|
1123
|
+
|
1131
1124
|
if const_name
|
1132
1125
|
type = type_env.get(const: const_name) do
|
1133
1126
|
fallback_to_any node
|
@@ -1141,7 +1134,8 @@ module Steep
|
|
1141
1134
|
yield_self do
|
1142
1135
|
const_name = Names::Module.from_node(node)
|
1143
1136
|
if const_name
|
1144
|
-
|
1137
|
+
const_type = type_env.get(const: const_name) {}
|
1138
|
+
value_type = synthesize(node.children.last, hint: const_type).type
|
1145
1139
|
type = type_env.assign(const: const_name, type: value_type, self_type: self_type) do |error|
|
1146
1140
|
case error
|
1147
1141
|
when Subtyping::Result::Failure
|
@@ -1262,7 +1256,7 @@ module Steep
|
|
1262
1256
|
end
|
1263
1257
|
end
|
1264
1258
|
else
|
1265
|
-
[select_super_type(synthesize(e).type, element_hint)]
|
1259
|
+
[select_super_type(synthesize(e, hint: element_hint).type, element_hint)]
|
1266
1260
|
end
|
1267
1261
|
end
|
1268
1262
|
array_type = AST::Builtin::Array.instance_type(AST::Types::Union.build(types: element_types))
|
@@ -2729,10 +2723,10 @@ module Steep
|
|
2729
2723
|
end
|
2730
2724
|
|
2731
2725
|
def nested_namespace_for_module(module_name)
|
2732
|
-
if module_name.relative?
|
2733
|
-
current_namespace.append(module_name.name)
|
2726
|
+
if module_name.relative?
|
2727
|
+
(current_namespace + module_name.namespace).append(module_name.name)
|
2734
2728
|
else
|
2735
|
-
|
2729
|
+
module_name
|
2736
2730
|
end
|
2737
2731
|
end
|
2738
2732
|
|
@@ -15,26 +15,18 @@ module Steep
|
|
15
15
|
@table = RBS::ConstantTable.new(builder: factory.definition_builder)
|
16
16
|
end
|
17
17
|
|
18
|
-
def namespace
|
19
|
-
@namespace ||= if context
|
20
|
-
context.namespace.append(context.name)
|
21
|
-
else
|
22
|
-
AST::Namespace.root
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
18
|
def lookup(name)
|
27
19
|
cache[name] ||= begin
|
28
20
|
constant = table.resolve_constant_reference(
|
29
21
|
factory.type_name_1(name),
|
30
|
-
context: factory.namespace_1(namespace)
|
22
|
+
context: context.map {|namespace| factory.namespace_1(namespace) }
|
31
23
|
)
|
32
24
|
|
33
25
|
if constant
|
34
26
|
factory.type(constant.type)
|
35
27
|
end
|
36
28
|
rescue => exn
|
37
|
-
Steep.logger.error "Looking up a constant failed: name=#{name}, context
|
29
|
+
Steep.logger.error "Looking up a constant failed: name=#{name}, context=[#{context.join(", ")}], error=#{exn.inspect}"
|
38
30
|
nil
|
39
31
|
end
|
40
32
|
end
|
data/lib/steep/version.rb
CHANGED
data/steep.gemspec
CHANGED
@@ -14,14 +14,13 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/soutaro/steep"
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/soutaro/steep"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/soutaro/steep/blob/master/CHANGELOG.md"
|
20
|
+
|
17
21
|
spec.files = `git ls-files -z`.split("\x0").reject {|f|
|
18
22
|
f.match(%r{^(test|spec|features)/})
|
19
|
-
} + Dir.chdir("vendor/ruby-signature") {
|
20
|
-
`git ls-files -z`.split("\x0")
|
21
|
-
.reject {|f| f.match(%r{^(test|spec|features)/}) }
|
22
|
-
.map {|f| File.join("vendor/ruby-signature", f) }
|
23
23
|
}
|
24
|
-
spec.files << "vendor/ruby-signature/lib/rbs/parser.rb"
|
25
24
|
|
26
25
|
spec.bindir = "exe"
|
27
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
@@ -33,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
33
32
|
spec.add_development_dependency "rake", "~> 13.0"
|
34
33
|
spec.add_development_dependency "minitest", "~> 5.0"
|
35
34
|
spec.add_development_dependency "racc", "~> 1.4"
|
36
|
-
spec.add_development_dependency "minitest-reporters", "~> 1.
|
35
|
+
spec.add_development_dependency "minitest-reporters", "~> 1.4.2"
|
37
36
|
spec.add_development_dependency "minitest-hooks", "~> 1.5.0"
|
38
37
|
|
39
38
|
spec.add_runtime_dependency "parser", "~> 2.7.0"
|
@@ -41,6 +40,6 @@ Gem::Specification.new do |spec|
|
|
41
40
|
spec.add_runtime_dependency "activesupport", ">= 5.1"
|
42
41
|
spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
|
43
42
|
spec.add_runtime_dependency "listen", "~> 3.1"
|
44
|
-
spec.add_runtime_dependency "pry", "~> 0.12.2"
|
45
43
|
spec.add_runtime_dependency "language_server-protocol", "~> 3.14.0.2"
|
44
|
+
spec.add_runtime_dependency "rbs", ">= 0.3.1", '< 0.5.0'
|
46
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.4.2
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.4.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest-hooks
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,38 +171,43 @@ dependencies:
|
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '3.1'
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
|
-
name:
|
174
|
+
name: language_server-protocol
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: 0.
|
179
|
+
version: 3.14.0.2
|
180
180
|
type: :runtime
|
181
181
|
prerelease: false
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
184
|
- - "~>"
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version: 0.
|
186
|
+
version: 3.14.0.2
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
|
-
name:
|
188
|
+
name: rbs
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
|
-
- - "
|
191
|
+
- - ">="
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version: 3.
|
193
|
+
version: 0.3.1
|
194
|
+
- - "<"
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: 0.5.0
|
194
197
|
type: :runtime
|
195
198
|
prerelease: false
|
196
199
|
version_requirements: !ruby/object:Gem::Requirement
|
197
200
|
requirements:
|
198
|
-
- - "
|
201
|
+
- - ">="
|
199
202
|
- !ruby/object:Gem::Version
|
200
|
-
version: 3.
|
203
|
+
version: 0.3.1
|
204
|
+
- - "<"
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 0.5.0
|
201
207
|
description: Gradual Typing for Ruby
|
202
208
|
email:
|
203
209
|
- matsumoto@soutaro.com
|
204
210
|
executables:
|
205
|
-
- rbs
|
206
211
|
- steep
|
207
212
|
extensions: []
|
208
213
|
extra_rdoc_files: []
|
@@ -219,7 +224,6 @@ files:
|
|
219
224
|
- bin/console
|
220
225
|
- bin/setup
|
221
226
|
- bin/smoke_runner.rb
|
222
|
-
- exe/rbs
|
223
227
|
- exe/steep
|
224
228
|
- lib/steep.rb
|
225
229
|
- lib/steep/annotation_parser.rb
|
@@ -437,140 +441,13 @@ files:
|
|
437
441
|
- smoke/yield/Steepfile
|
438
442
|
- smoke/yield/a.rb
|
439
443
|
- steep.gemspec
|
440
|
-
- vendor/ruby-signature/.github/workflows/ruby.yml
|
441
|
-
- vendor/ruby-signature/.gitignore
|
442
|
-
- vendor/ruby-signature/.rubocop.yml
|
443
|
-
- vendor/ruby-signature/BSDL
|
444
|
-
- vendor/ruby-signature/COPYING
|
445
|
-
- vendor/ruby-signature/Gemfile
|
446
|
-
- vendor/ruby-signature/README.md
|
447
|
-
- vendor/ruby-signature/Rakefile
|
448
|
-
- vendor/ruby-signature/bin/annotate-with-rdoc
|
449
|
-
- vendor/ruby-signature/bin/console
|
450
|
-
- vendor/ruby-signature/bin/query-rdoc
|
451
|
-
- vendor/ruby-signature/bin/setup
|
452
|
-
- vendor/ruby-signature/bin/sort
|
453
|
-
- vendor/ruby-signature/bin/test_runner.rb
|
454
|
-
- vendor/ruby-signature/docs/CONTRIBUTING.md
|
455
|
-
- vendor/ruby-signature/docs/sigs.md
|
456
|
-
- vendor/ruby-signature/docs/stdlib.md
|
457
|
-
- vendor/ruby-signature/docs/syntax.md
|
458
|
-
- vendor/ruby-signature/exe/rbs
|
459
|
-
- vendor/ruby-signature/lib/rbs.rb
|
460
|
-
- vendor/ruby-signature/lib/rbs/ast/annotation.rb
|
461
|
-
- vendor/ruby-signature/lib/rbs/ast/comment.rb
|
462
|
-
- vendor/ruby-signature/lib/rbs/ast/declarations.rb
|
463
|
-
- vendor/ruby-signature/lib/rbs/ast/members.rb
|
464
|
-
- vendor/ruby-signature/lib/rbs/buffer.rb
|
465
|
-
- vendor/ruby-signature/lib/rbs/builtin_names.rb
|
466
|
-
- vendor/ruby-signature/lib/rbs/cli.rb
|
467
|
-
- vendor/ruby-signature/lib/rbs/constant.rb
|
468
|
-
- vendor/ruby-signature/lib/rbs/constant_table.rb
|
469
|
-
- vendor/ruby-signature/lib/rbs/definition.rb
|
470
|
-
- vendor/ruby-signature/lib/rbs/definition_builder.rb
|
471
|
-
- vendor/ruby-signature/lib/rbs/environment.rb
|
472
|
-
- vendor/ruby-signature/lib/rbs/environment_loader.rb
|
473
|
-
- vendor/ruby-signature/lib/rbs/environment_walker.rb
|
474
|
-
- vendor/ruby-signature/lib/rbs/errors.rb
|
475
|
-
- vendor/ruby-signature/lib/rbs/location.rb
|
476
|
-
- vendor/ruby-signature/lib/rbs/method_type.rb
|
477
|
-
- vendor/ruby-signature/lib/rbs/namespace.rb
|
478
|
-
- vendor/ruby-signature/lib/rbs/parser.rb
|
479
|
-
- vendor/ruby-signature/lib/rbs/parser.y
|
480
|
-
- vendor/ruby-signature/lib/rbs/prototype/rb.rb
|
481
|
-
- vendor/ruby-signature/lib/rbs/prototype/rbi.rb
|
482
|
-
- vendor/ruby-signature/lib/rbs/prototype/runtime.rb
|
483
|
-
- vendor/ruby-signature/lib/rbs/substitution.rb
|
484
|
-
- vendor/ruby-signature/lib/rbs/test.rb
|
485
|
-
- vendor/ruby-signature/lib/rbs/test/errors.rb
|
486
|
-
- vendor/ruby-signature/lib/rbs/test/hook.rb
|
487
|
-
- vendor/ruby-signature/lib/rbs/test/setup.rb
|
488
|
-
- vendor/ruby-signature/lib/rbs/test/spy.rb
|
489
|
-
- vendor/ruby-signature/lib/rbs/test/test_helper.rb
|
490
|
-
- vendor/ruby-signature/lib/rbs/test/type_check.rb
|
491
|
-
- vendor/ruby-signature/lib/rbs/type_name.rb
|
492
|
-
- vendor/ruby-signature/lib/rbs/types.rb
|
493
|
-
- vendor/ruby-signature/lib/rbs/variance_calculator.rb
|
494
|
-
- vendor/ruby-signature/lib/rbs/vendorer.rb
|
495
|
-
- vendor/ruby-signature/lib/rbs/version.rb
|
496
|
-
- vendor/ruby-signature/lib/rbs/writer.rb
|
497
|
-
- vendor/ruby-signature/lib/ruby/signature.rb
|
498
|
-
- vendor/ruby-signature/rbs.gemspec
|
499
|
-
- vendor/ruby-signature/stdlib/abbrev/abbrev.rbs
|
500
|
-
- vendor/ruby-signature/stdlib/base64/base64.rbs
|
501
|
-
- vendor/ruby-signature/stdlib/benchmark/benchmark.rbs
|
502
|
-
- vendor/ruby-signature/stdlib/builtin/array.rbs
|
503
|
-
- vendor/ruby-signature/stdlib/builtin/basic_object.rbs
|
504
|
-
- vendor/ruby-signature/stdlib/builtin/binding.rbs
|
505
|
-
- vendor/ruby-signature/stdlib/builtin/builtin.rbs
|
506
|
-
- vendor/ruby-signature/stdlib/builtin/class.rbs
|
507
|
-
- vendor/ruby-signature/stdlib/builtin/comparable.rbs
|
508
|
-
- vendor/ruby-signature/stdlib/builtin/complex.rbs
|
509
|
-
- vendor/ruby-signature/stdlib/builtin/constants.rbs
|
510
|
-
- vendor/ruby-signature/stdlib/builtin/data.rbs
|
511
|
-
- vendor/ruby-signature/stdlib/builtin/deprecated.rbs
|
512
|
-
- vendor/ruby-signature/stdlib/builtin/dir.rbs
|
513
|
-
- vendor/ruby-signature/stdlib/builtin/encoding.rbs
|
514
|
-
- vendor/ruby-signature/stdlib/builtin/enumerable.rbs
|
515
|
-
- vendor/ruby-signature/stdlib/builtin/enumerator.rbs
|
516
|
-
- vendor/ruby-signature/stdlib/builtin/errno.rbs
|
517
|
-
- vendor/ruby-signature/stdlib/builtin/errors.rbs
|
518
|
-
- vendor/ruby-signature/stdlib/builtin/exception.rbs
|
519
|
-
- vendor/ruby-signature/stdlib/builtin/false_class.rbs
|
520
|
-
- vendor/ruby-signature/stdlib/builtin/fiber.rbs
|
521
|
-
- vendor/ruby-signature/stdlib/builtin/fiber_error.rbs
|
522
|
-
- vendor/ruby-signature/stdlib/builtin/file.rbs
|
523
|
-
- vendor/ruby-signature/stdlib/builtin/file_test.rbs
|
524
|
-
- vendor/ruby-signature/stdlib/builtin/float.rbs
|
525
|
-
- vendor/ruby-signature/stdlib/builtin/gc.rbs
|
526
|
-
- vendor/ruby-signature/stdlib/builtin/hash.rbs
|
527
|
-
- vendor/ruby-signature/stdlib/builtin/integer.rbs
|
528
|
-
- vendor/ruby-signature/stdlib/builtin/io.rbs
|
529
|
-
- vendor/ruby-signature/stdlib/builtin/kernel.rbs
|
530
|
-
- vendor/ruby-signature/stdlib/builtin/marshal.rbs
|
531
|
-
- vendor/ruby-signature/stdlib/builtin/match_data.rbs
|
532
|
-
- vendor/ruby-signature/stdlib/builtin/math.rbs
|
533
|
-
- vendor/ruby-signature/stdlib/builtin/method.rbs
|
534
|
-
- vendor/ruby-signature/stdlib/builtin/module.rbs
|
535
|
-
- vendor/ruby-signature/stdlib/builtin/nil_class.rbs
|
536
|
-
- vendor/ruby-signature/stdlib/builtin/numeric.rbs
|
537
|
-
- vendor/ruby-signature/stdlib/builtin/object.rbs
|
538
|
-
- vendor/ruby-signature/stdlib/builtin/proc.rbs
|
539
|
-
- vendor/ruby-signature/stdlib/builtin/process.rbs
|
540
|
-
- vendor/ruby-signature/stdlib/builtin/random.rbs
|
541
|
-
- vendor/ruby-signature/stdlib/builtin/range.rbs
|
542
|
-
- vendor/ruby-signature/stdlib/builtin/rational.rbs
|
543
|
-
- vendor/ruby-signature/stdlib/builtin/rb_config.rbs
|
544
|
-
- vendor/ruby-signature/stdlib/builtin/regexp.rbs
|
545
|
-
- vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs
|
546
|
-
- vendor/ruby-signature/stdlib/builtin/signal.rbs
|
547
|
-
- vendor/ruby-signature/stdlib/builtin/string.rbs
|
548
|
-
- vendor/ruby-signature/stdlib/builtin/string_io.rbs
|
549
|
-
- vendor/ruby-signature/stdlib/builtin/struct.rbs
|
550
|
-
- vendor/ruby-signature/stdlib/builtin/symbol.rbs
|
551
|
-
- vendor/ruby-signature/stdlib/builtin/thread.rbs
|
552
|
-
- vendor/ruby-signature/stdlib/builtin/thread_group.rbs
|
553
|
-
- vendor/ruby-signature/stdlib/builtin/time.rbs
|
554
|
-
- vendor/ruby-signature/stdlib/builtin/trace_point.rbs
|
555
|
-
- vendor/ruby-signature/stdlib/builtin/true_class.rbs
|
556
|
-
- vendor/ruby-signature/stdlib/builtin/unbound_method.rbs
|
557
|
-
- vendor/ruby-signature/stdlib/builtin/warning.rbs
|
558
|
-
- vendor/ruby-signature/stdlib/coverage/coverage.rbs
|
559
|
-
- vendor/ruby-signature/stdlib/csv/csv.rbs
|
560
|
-
- vendor/ruby-signature/stdlib/erb/erb.rbs
|
561
|
-
- vendor/ruby-signature/stdlib/find/find.rbs
|
562
|
-
- vendor/ruby-signature/stdlib/ipaddr/ipaddr.rbs
|
563
|
-
- vendor/ruby-signature/stdlib/json/json.rbs
|
564
|
-
- vendor/ruby-signature/stdlib/pathname/pathname.rbs
|
565
|
-
- vendor/ruby-signature/stdlib/prime/integer-extension.rbs
|
566
|
-
- vendor/ruby-signature/stdlib/prime/prime.rbs
|
567
|
-
- vendor/ruby-signature/stdlib/securerandom/securerandom.rbs
|
568
|
-
- vendor/ruby-signature/stdlib/set/set.rbs
|
569
|
-
- vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs
|
570
444
|
homepage: https://github.com/soutaro/steep
|
571
445
|
licenses:
|
572
446
|
- MIT
|
573
|
-
metadata:
|
447
|
+
metadata:
|
448
|
+
homepage_uri: https://github.com/soutaro/steep
|
449
|
+
source_code_uri: https://github.com/soutaro/steep
|
450
|
+
changelog_uri: https://github.com/soutaro/steep/blob/master/CHANGELOG.md
|
574
451
|
post_install_message:
|
575
452
|
rdoc_options: []
|
576
453
|
require_paths:
|
@@ -586,7 +463,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
586
463
|
- !ruby/object:Gem::Version
|
587
464
|
version: '0'
|
588
465
|
requirements: []
|
589
|
-
rubygems_version: 3.0.
|
466
|
+
rubygems_version: 3.0.3
|
590
467
|
signing_key:
|
591
468
|
specification_version: 4
|
592
469
|
summary: Gradual Typing for Ruby
|