steep 0.42.0 → 0.43.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/lib/steep.rb +4 -3
- data/lib/steep/annotation_parser.rb +10 -2
- data/lib/steep/cli.rb +1 -0
- data/lib/steep/diagnostic/ruby.rb +15 -6
- data/lib/steep/diagnostic/signature.rb +28 -11
- data/lib/steep/drivers/annotations.rb +1 -3
- data/lib/steep/drivers/check.rb +17 -7
- data/lib/steep/drivers/diagnostic_printer.rb +4 -0
- data/lib/steep/drivers/langserver.rb +1 -0
- data/lib/steep/drivers/print_project.rb +1 -1
- data/lib/steep/drivers/stats.rb +125 -105
- data/lib/steep/drivers/utils/driver_helper.rb +35 -0
- data/lib/steep/drivers/validate.rb +1 -1
- data/lib/steep/drivers/watch.rb +12 -10
- data/lib/steep/index/signature_symbol_provider.rb +20 -6
- data/lib/steep/project/target.rb +4 -4
- data/lib/steep/server/interaction_worker.rb +2 -3
- data/lib/steep/server/master.rb +621 -170
- data/lib/steep/server/type_check_worker.rb +127 -13
- data/lib/steep/server/worker_process.rb +7 -4
- data/lib/steep/services/completion_provider.rb +2 -2
- data/lib/steep/services/hover_content.rb +5 -4
- data/lib/steep/services/path_assignment.rb +6 -8
- data/lib/steep/services/signature_service.rb +43 -9
- data/lib/steep/services/type_check_service.rb +184 -138
- data/lib/steep/signature/validator.rb +17 -9
- data/lib/steep/source.rb +21 -18
- data/lib/steep/subtyping/constraints.rb +2 -2
- data/lib/steep/type_construction.rb +223 -125
- data/lib/steep/type_inference/block_params.rb +1 -1
- data/lib/steep/type_inference/context.rb +22 -0
- data/lib/steep/type_inference/logic.rb +1 -1
- data/lib/steep/type_inference/logic_type_interpreter.rb +3 -3
- data/lib/steep/version.rb +1 -1
- data/smoke/implements/b.rb +13 -0
- data/smoke/implements/b.rbs +12 -0
- data/smoke/regression/issue_328.rb +1 -0
- data/smoke/regression/issue_328.rbs +0 -0
- data/smoke/regression/issue_332.rb +11 -0
- data/smoke/regression/issue_332.rbs +19 -0
- data/smoke/regression/masgn.rb +4 -0
- data/smoke/regression/test_expectations.yml +29 -0
- data/smoke/regression/thread.rb +7 -0
- data/smoke/super/test_expectations.yml +2 -12
- data/steep.gemspec +2 -2
- metadata +40 -20
@@ -78,6 +78,28 @@ module Steep
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
81
|
+
|
82
|
+
def update(
|
83
|
+
instance_type: self.instance_type,
|
84
|
+
module_type: self.module_type,
|
85
|
+
implement_name: self.implement_name,
|
86
|
+
current_namespace: self.current_namespace,
|
87
|
+
const_env: self.const_env,
|
88
|
+
class_name: self.class_name,
|
89
|
+
instance_definition: self.instance_definition,
|
90
|
+
module_definition: self.module_definition
|
91
|
+
)
|
92
|
+
ModuleContext.new(
|
93
|
+
instance_type: instance_type,
|
94
|
+
module_type: module_type,
|
95
|
+
implement_name: implement_name,
|
96
|
+
current_namespace: current_namespace,
|
97
|
+
const_env: const_env,
|
98
|
+
class_name: class_name,
|
99
|
+
instance_definition: instance_definition,
|
100
|
+
module_definition: module_definition
|
101
|
+
)
|
102
|
+
end
|
81
103
|
end
|
82
104
|
|
83
105
|
attr_reader :call_context
|
@@ -159,16 +159,16 @@ module Steep
|
|
159
159
|
def decompose_value(node)
|
160
160
|
case node.type
|
161
161
|
when :lvar
|
162
|
-
[node, Set[node.children[0]
|
162
|
+
[node, Set[node.children[0]]]
|
163
163
|
when :masgn
|
164
164
|
lhs, rhs = node.children
|
165
|
-
lhs_vars = lhs.children.select {|m| m.type == :lvasgn }.map {|m| m.children[0]
|
165
|
+
lhs_vars = lhs.children.select {|m| m.type == :lvasgn }.map {|m| m.children[0] }
|
166
166
|
val, vars = decompose_value(rhs)
|
167
167
|
[val, vars + lhs_vars]
|
168
168
|
when :lvasgn
|
169
169
|
var, rhs = node.children
|
170
170
|
val, vars = decompose_value(rhs)
|
171
|
-
[val, vars + [var
|
171
|
+
[val, vars + [var]]
|
172
172
|
when :begin
|
173
173
|
decompose_value(node.children.last)
|
174
174
|
when :and
|
data/lib/steep/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
["abc", "d", ""].to_h { |e| [e, e.size] }
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Issue332
|
2
|
+
class Duration
|
3
|
+
end
|
4
|
+
|
5
|
+
interface _TimeDurationExtensions
|
6
|
+
def -: (Numeric other) -> Time
|
7
|
+
| (Time other) -> Float
|
8
|
+
end
|
9
|
+
|
10
|
+
module TimeDurationExtensions : _TimeDurationExtensions
|
11
|
+
def -: (Duration other) -> Time
|
12
|
+
| ...
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Time
|
17
|
+
prepend Issue332::TimeDurationExtensions
|
18
|
+
end
|
19
|
+
|
@@ -1,4 +1,21 @@
|
|
1
1
|
---
|
2
|
+
- file: issue_332.rb
|
3
|
+
diagnostics:
|
4
|
+
- range:
|
5
|
+
start:
|
6
|
+
line: 7
|
7
|
+
character: 8
|
8
|
+
end:
|
9
|
+
line: 7
|
10
|
+
character: 20
|
11
|
+
severity: ERROR
|
12
|
+
message: |-
|
13
|
+
Cannot find compatible overloading of method `-` of type `(::Object & ::Issue332::_TimeDurationExtensions & ::Issue332::TimeDurationExtensions)`
|
14
|
+
Method types:
|
15
|
+
def -: (::Issue332::Duration) -> ::Time
|
16
|
+
| (::Numeric) -> ::Time
|
17
|
+
| (::Time) -> ::Float
|
18
|
+
code: Ruby::UnresolvedOverloading
|
2
19
|
- file: set_divide.rb
|
3
20
|
diagnostics:
|
4
21
|
- range:
|
@@ -41,3 +58,15 @@
|
|
41
58
|
severity: ERROR
|
42
59
|
message: Type `::String` does not have method `ggggg`
|
43
60
|
code: Ruby::NoMethod
|
61
|
+
- file: thread.rb
|
62
|
+
diagnostics:
|
63
|
+
- range:
|
64
|
+
start:
|
65
|
+
line: 6
|
66
|
+
character: 13
|
67
|
+
end:
|
68
|
+
line: 7
|
69
|
+
character: 3
|
70
|
+
severity: ERROR
|
71
|
+
message: The method cannot be called with a block
|
72
|
+
code: Ruby::UnexpectedBlockGiven
|
@@ -55,7 +55,7 @@
|
|
55
55
|
line: 26
|
56
56
|
character: 11
|
57
57
|
severity: ERROR
|
58
|
-
message:
|
58
|
+
message: No superclass method `baz` defined
|
59
59
|
code: Ruby::UnexpectedSuper
|
60
60
|
- range:
|
61
61
|
start:
|
@@ -65,15 +65,5 @@
|
|
65
65
|
line: 28
|
66
66
|
character: 9
|
67
67
|
severity: ERROR
|
68
|
-
message:
|
69
|
-
code: Ruby::FallbackAny
|
70
|
-
- range:
|
71
|
-
start:
|
72
|
-
line: 28
|
73
|
-
character: 4
|
74
|
-
end:
|
75
|
-
line: 28
|
76
|
-
character: 9
|
77
|
-
severity: ERROR
|
78
|
-
message: UnexpectedSuper
|
68
|
+
message: No superclass method `baz` defined
|
79
69
|
code: Ruby::UnexpectedSuper
|
data/steep.gemspec
CHANGED
@@ -29,11 +29,11 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.required_ruby_version = '>= 2.6.0'
|
30
30
|
|
31
31
|
spec.add_runtime_dependency "parser", ">= 2.7"
|
32
|
-
spec.add_runtime_dependency "ast_utils", ">= 0.4.0"
|
33
32
|
spec.add_runtime_dependency "activesupport", ">= 5.1"
|
34
33
|
spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
|
35
34
|
spec.add_runtime_dependency "listen", "~> 3.0"
|
36
|
-
spec.add_runtime_dependency "language_server-protocol", "
|
35
|
+
spec.add_runtime_dependency "language_server-protocol", ">= 3.15", "< 4.0"
|
37
36
|
spec.add_runtime_dependency "rbs", "~> 1.1.0"
|
38
37
|
spec.add_runtime_dependency "parallel", ">= 1.0.0"
|
38
|
+
spec.add_runtime_dependency "terminal-table", ">= 2", "< 4"
|
39
39
|
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.43.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.7'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: ast_utils
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.4.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.4.0
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: activesupport
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,16 +76,22 @@ dependencies:
|
|
90
76
|
name: language_server-protocol
|
91
77
|
requirement: !ruby/object:Gem::Requirement
|
92
78
|
requirements:
|
93
|
-
- - "
|
79
|
+
- - ">="
|
94
80
|
- !ruby/object:Gem::Version
|
95
|
-
version: 3.15
|
81
|
+
version: '3.15'
|
82
|
+
- - "<"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '4.0'
|
96
85
|
type: :runtime
|
97
86
|
prerelease: false
|
98
87
|
version_requirements: !ruby/object:Gem::Requirement
|
99
88
|
requirements:
|
100
|
-
- - "
|
89
|
+
- - ">="
|
101
90
|
- !ruby/object:Gem::Version
|
102
|
-
version: 3.15
|
91
|
+
version: '3.15'
|
92
|
+
- - "<"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '4.0'
|
103
95
|
- !ruby/object:Gem::Dependency
|
104
96
|
name: rbs
|
105
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,6 +120,26 @@ dependencies:
|
|
128
120
|
- - ">="
|
129
121
|
- !ruby/object:Gem::Version
|
130
122
|
version: 1.0.0
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: terminal-table
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '2'
|
130
|
+
- - "<"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '4'
|
133
|
+
type: :runtime
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '2'
|
140
|
+
- - "<"
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '4'
|
131
143
|
description: Gradual Typing for Ruby
|
132
144
|
email:
|
133
145
|
- matsumoto@soutaro.com
|
@@ -385,6 +397,8 @@ files:
|
|
385
397
|
- smoke/implements/Steepfile
|
386
398
|
- smoke/implements/a.rb
|
387
399
|
- smoke/implements/a.rbs
|
400
|
+
- smoke/implements/b.rb
|
401
|
+
- smoke/implements/b.rbs
|
388
402
|
- smoke/implements/test_expectations.yml
|
389
403
|
- smoke/initialize/Steepfile
|
390
404
|
- smoke/initialize/a.rb
|
@@ -437,11 +451,17 @@ files:
|
|
437
451
|
- smoke/regression/fun.rb
|
438
452
|
- smoke/regression/fun.rbs
|
439
453
|
- smoke/regression/hash.rb
|
454
|
+
- smoke/regression/issue_328.rb
|
455
|
+
- smoke/regression/issue_328.rbs
|
456
|
+
- smoke/regression/issue_332.rb
|
457
|
+
- smoke/regression/issue_332.rbs
|
458
|
+
- smoke/regression/masgn.rb
|
440
459
|
- smoke/regression/poly_new.rb
|
441
460
|
- smoke/regression/poly_new.rbs
|
442
461
|
- smoke/regression/range.rb
|
443
462
|
- smoke/regression/set_divide.rb
|
444
463
|
- smoke/regression/test_expectations.yml
|
464
|
+
- smoke/regression/thread.rb
|
445
465
|
- smoke/rescue/Steepfile
|
446
466
|
- smoke/rescue/a.rb
|
447
467
|
- smoke/rescue/test_expectations.yml
|