steep 1.8.0.dev.1 → 1.8.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -0
- data/README.md +3 -2
- data/bin/mem_graph.rb +67 -0
- data/bin/mem_prof.rb +102 -0
- data/bin/stackprof_test.rb +19 -0
- data/bin/steep-check.rb +251 -0
- data/guides/src/gem-rbs-collection/gem-rbs-collection.md +1 -1
- data/lib/steep/annotation_parser.rb +1 -1
- data/lib/steep/ast/builtin.rb +5 -5
- data/lib/steep/ast/node/type_application.rb +7 -6
- data/lib/steep/ast/types/any.rb +1 -9
- data/lib/steep/ast/types/boolean.rb +8 -16
- data/lib/steep/ast/types/bot.rb +2 -10
- data/lib/steep/ast/types/class.rb +1 -13
- data/lib/steep/ast/types/factory.rb +101 -85
- data/lib/steep/ast/types/instance.rb +1 -13
- data/lib/steep/ast/types/intersection.rb +8 -15
- data/lib/steep/ast/types/literal.rb +2 -8
- data/lib/steep/ast/types/logic.rb +3 -24
- data/lib/steep/ast/types/name.rb +5 -16
- data/lib/steep/ast/types/nil.rb +3 -12
- data/lib/steep/ast/types/proc.rb +4 -13
- data/lib/steep/ast/types/record.rb +21 -12
- data/lib/steep/ast/types/self.rb +1 -13
- data/lib/steep/ast/types/shared_instance.rb +11 -0
- data/lib/steep/ast/types/top.rb +1 -9
- data/lib/steep/ast/types/tuple.rb +4 -10
- data/lib/steep/ast/types/union.rb +10 -15
- data/lib/steep/ast/types/var.rb +4 -13
- data/lib/steep/ast/types/void.rb +2 -10
- data/lib/steep/diagnostic/ruby.rb +10 -10
- data/lib/steep/drivers/check.rb +11 -14
- data/lib/steep/drivers/checkfile.rb +8 -10
- data/lib/steep/drivers/stats.rb +17 -13
- data/lib/steep/drivers/utils/driver_helper.rb +24 -3
- data/lib/steep/drivers/watch.rb +3 -3
- data/lib/steep/interface/builder.rb +162 -138
- data/lib/steep/interface/method_type.rb +12 -20
- data/lib/steep/interface/shape.rb +66 -10
- data/lib/steep/interface/substitution.rb +2 -0
- data/lib/steep/interface/type_param.rb +20 -7
- data/lib/steep/located_value.rb +20 -0
- data/lib/steep/server/change_buffer.rb +5 -7
- data/lib/steep/server/custom_methods.rb +61 -0
- data/lib/steep/server/delay_queue.rb +8 -1
- data/lib/steep/server/interaction_worker.rb +13 -6
- data/lib/steep/server/lsp_formatter.rb +8 -6
- data/lib/steep/server/master.rb +195 -142
- data/lib/steep/server/type_check_worker.rb +25 -22
- data/lib/steep/server/work_done_progress.rb +64 -0
- data/lib/steep/server/worker_process.rb +1 -1
- data/lib/steep/services/completion_provider.rb +32 -24
- data/lib/steep/services/goto_service.rb +3 -2
- data/lib/steep/services/hover_provider/ruby.rb +30 -17
- data/lib/steep/services/signature_help_provider.rb +9 -7
- data/lib/steep/services/signature_service.rb +1 -1
- data/lib/steep/services/type_check_service.rb +19 -9
- data/lib/steep/signature/validator.rb +17 -20
- data/lib/steep/source.rb +47 -1
- data/lib/steep/subtyping/check.rb +105 -55
- data/lib/steep/subtyping/constraints.rb +13 -17
- data/lib/steep/type_construction.rb +106 -100
- data/lib/steep/type_inference/block_params.rb +8 -5
- data/lib/steep/type_inference/logic_type_interpreter.rb +11 -7
- data/lib/steep/type_inference/method_call.rb +3 -3
- data/lib/steep/type_inference/method_params.rb +1 -1
- data/lib/steep/type_inference/send_args.rb +1 -1
- data/lib/steep/typing.rb +164 -106
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +29 -4
- data/steep.gemspec +2 -2
- metadata +16 -9
- data/lib/steep/type_inference/context_array.rb +0 -112
@@ -36,22 +36,22 @@ module Steep
|
|
36
36
|
method = node.children[1]
|
37
37
|
case method
|
38
38
|
when :is_a?, :kind_of?, :instance_of?
|
39
|
-
AST::Types::Logic::ReceiverIsArg.
|
39
|
+
AST::Types::Logic::ReceiverIsArg.instance
|
40
40
|
when :nil?
|
41
|
-
AST::Types::Logic::ReceiverIsNil.
|
41
|
+
AST::Types::Logic::ReceiverIsNil.instance
|
42
42
|
when :!
|
43
|
-
AST::Types::Logic::Not.
|
43
|
+
AST::Types::Logic::Not.instance
|
44
44
|
when :===
|
45
|
-
AST::Types::Logic::ArgIsReceiver.
|
45
|
+
AST::Types::Logic::ArgIsReceiver.instance
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
TRUE = AST::Types::Literal.new(value: true)
|
51
51
|
FALSE = AST::Types::Literal.new(value: false)
|
52
|
-
BOOL = AST::Types::Boolean.
|
53
|
-
BOT = AST::Types::Bot.
|
54
|
-
UNTYPED = AST::Types::Any.
|
52
|
+
BOOL = AST::Types::Boolean.instance
|
53
|
+
BOT = AST::Types::Bot.instance
|
54
|
+
UNTYPED = AST::Types::Any.instance
|
55
55
|
|
56
56
|
def eval(env:, node:)
|
57
57
|
evaluate_node(env: env, node: node)
|
@@ -77,6 +77,10 @@ module Steep
|
|
77
77
|
]
|
78
78
|
end
|
79
79
|
|
80
|
+
if type.is_a?(AST::Types::Var)
|
81
|
+
type = config.upper_bound(type.name) || type
|
82
|
+
end
|
83
|
+
|
80
84
|
case node.type
|
81
85
|
when :lvar
|
82
86
|
name = node.children[0]
|
@@ -165,7 +165,7 @@ module Steep
|
|
165
165
|
|
166
166
|
class Untyped < Base
|
167
167
|
def initialize(node:, context:, method_name:)
|
168
|
-
super(node: node, context: context, method_name: method_name, receiver_type: AST::Types::Any.
|
168
|
+
super(node: node, context: context, method_name: method_name, receiver_type: AST::Types::Any.instance, return_type: AST::Types::Any.instance)
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
@@ -173,7 +173,7 @@ module Steep
|
|
173
173
|
attr_reader :error
|
174
174
|
|
175
175
|
def initialize(node:, context:, method_name:, receiver_type:, error:)
|
176
|
-
super(node: node, context: context, method_name: method_name, receiver_type: receiver_type, return_type: AST::Types::Any.
|
176
|
+
super(node: node, context: context, method_name: method_name, receiver_type: receiver_type, return_type: AST::Types::Any.instance)
|
177
177
|
@error = error
|
178
178
|
end
|
179
179
|
end
|
@@ -182,7 +182,7 @@ module Steep
|
|
182
182
|
attr_reader :errors
|
183
183
|
attr_reader :method_decls
|
184
184
|
|
185
|
-
def initialize(node:, context:, method_name:, receiver_type:, errors:, method_decls: Set[], return_type: AST::Types::Any.
|
185
|
+
def initialize(node:, context:, method_name:, receiver_type:, errors:, method_decls: Set[], return_type: AST::Types::Any.instance)
|
186
186
|
super(node: node, context: context, method_name: method_name, receiver_type: receiver_type, return_type: return_type)
|
187
187
|
@method_decls = method_decls
|
188
188
|
@errors = errors
|
@@ -114,7 +114,7 @@ module Steep
|
|
114
114
|
proc_type = AST::Types::Proc.new(type: type, block: nil, self_type: self_type)
|
115
115
|
|
116
116
|
if optional?
|
117
|
-
AST::Types::Union.build(types: [proc_type, AST::Builtin.nil_type]
|
117
|
+
AST::Types::Union.build(types: [proc_type, AST::Builtin.nil_type])
|
118
118
|
else
|
119
119
|
proc_type
|
120
120
|
end
|
@@ -656,7 +656,7 @@ module Steep
|
|
656
656
|
errors << ts
|
657
657
|
when Array
|
658
658
|
pairs = keys.zip(ts) #: Array[[Symbol, AST::Types::t]]
|
659
|
-
record = AST::Types::Record.new(elements: Hash[pairs])
|
659
|
+
record = AST::Types::Record.new(elements: Hash[pairs], required_keys: Set.new(keys))
|
660
660
|
yield KeywordArgs::ArgTypePairs.new(pairs: [[a.node, record]])
|
661
661
|
end
|
662
662
|
else
|
data/lib/steep/typing.rb
CHANGED
@@ -11,6 +11,147 @@ module Steep
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
class CursorContext
|
15
|
+
attr_reader :index
|
16
|
+
|
17
|
+
attr_reader :data
|
18
|
+
|
19
|
+
def initialize(index)
|
20
|
+
@index = index
|
21
|
+
end
|
22
|
+
|
23
|
+
def set(range, context = nil)
|
24
|
+
if range.is_a?(CursorContext)
|
25
|
+
range, context = range.data
|
26
|
+
range or return
|
27
|
+
context or return
|
28
|
+
end
|
29
|
+
|
30
|
+
context or raise
|
31
|
+
return unless index
|
32
|
+
|
33
|
+
if current_range = self.range
|
34
|
+
if range.begin <= index && index <= range.end
|
35
|
+
if current_range.begin <= range.begin && range.end <= current_range.end
|
36
|
+
@data = [range, context]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
else
|
40
|
+
@data = [range, context]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def set_node_context(node, context)
|
45
|
+
begin_pos = node.loc.expression.begin_pos
|
46
|
+
end_pos = node.loc.expression.end_pos
|
47
|
+
|
48
|
+
set(begin_pos..end_pos, context)
|
49
|
+
end
|
50
|
+
|
51
|
+
def set_body_context(node, context)
|
52
|
+
case node.type
|
53
|
+
when :class
|
54
|
+
name_node, super_node, _ = node.children
|
55
|
+
begin_pos = if super_node
|
56
|
+
super_node.loc.expression.end_pos
|
57
|
+
else
|
58
|
+
name_node.loc.expression.end_pos
|
59
|
+
end
|
60
|
+
end_pos = node.loc.end.begin_pos # steep:ignore NoMethod
|
61
|
+
|
62
|
+
set(begin_pos..end_pos, context)
|
63
|
+
|
64
|
+
when :module
|
65
|
+
name_node = node.children[0]
|
66
|
+
begin_pos = name_node.loc.expression.end_pos
|
67
|
+
end_pos = node.loc.end.begin_pos # steep:ignore NoMethod
|
68
|
+
set(begin_pos..end_pos, context)
|
69
|
+
|
70
|
+
when :sclass
|
71
|
+
name_node = node.children[0]
|
72
|
+
begin_pos = name_node.loc.expression.end_pos
|
73
|
+
end_pos = node.loc.end.begin_pos # steep:ignore NoMethod
|
74
|
+
set(begin_pos..end_pos, context)
|
75
|
+
|
76
|
+
when :def, :defs
|
77
|
+
if node.children.last
|
78
|
+
args_node =
|
79
|
+
case node.type
|
80
|
+
when :def
|
81
|
+
node.children[1]
|
82
|
+
when :defs
|
83
|
+
node.children[2]
|
84
|
+
end
|
85
|
+
|
86
|
+
body_begin_pos =
|
87
|
+
case
|
88
|
+
when node.loc.assignment # steep:ignore NoMethod
|
89
|
+
# endless def
|
90
|
+
node.loc.assignment.end_pos # steep:ignore NoMethod
|
91
|
+
when args_node.loc.expression
|
92
|
+
# with args
|
93
|
+
args_node.loc.expression.end_pos
|
94
|
+
else
|
95
|
+
# without args
|
96
|
+
node.loc.name.end_pos # steep:ignore NoMethod
|
97
|
+
end
|
98
|
+
|
99
|
+
body_end_pos =
|
100
|
+
if node.loc.end # steep:ignore NoMethod
|
101
|
+
node.loc.end.begin_pos # steep:ignore NoMethod
|
102
|
+
else
|
103
|
+
node.loc.expression.end_pos
|
104
|
+
end
|
105
|
+
|
106
|
+
set(body_begin_pos..body_end_pos, context)
|
107
|
+
end
|
108
|
+
|
109
|
+
when :block, :numblock
|
110
|
+
range = block_range(node)
|
111
|
+
set(range, context)
|
112
|
+
|
113
|
+
when :for
|
114
|
+
_, collection, _ = node.children
|
115
|
+
|
116
|
+
begin_pos = collection.loc.expression.end_pos
|
117
|
+
end_pos = node.loc.end.begin_pos # steep:ignore NoMethod
|
118
|
+
|
119
|
+
set(begin_pos..end_pos, context)
|
120
|
+
else
|
121
|
+
raise "Unexpected node for insert_context: #{node.type}"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def block_range(node)
|
126
|
+
case node.type
|
127
|
+
when :block
|
128
|
+
send_node, args_node, _ = node.children
|
129
|
+
begin_pos = if send_node.type != :lambda && args_node.loc.expression
|
130
|
+
args_node.loc.expression.end_pos
|
131
|
+
else
|
132
|
+
node.loc.begin.end_pos # steep:ignore NoMethod
|
133
|
+
end
|
134
|
+
end_pos = node.loc.end.begin_pos # steep:ignore NoMethod
|
135
|
+
when :numblock
|
136
|
+
send_node, _ = node.children
|
137
|
+
begin_pos = node.loc.begin.end_pos # steep:ignore NoMethod
|
138
|
+
end_pos = node.loc.end.begin_pos # steep:ignore NoMethod
|
139
|
+
end
|
140
|
+
|
141
|
+
begin_pos..end_pos
|
142
|
+
end
|
143
|
+
|
144
|
+
def range
|
145
|
+
range, _ = data
|
146
|
+
range
|
147
|
+
end
|
148
|
+
|
149
|
+
def context
|
150
|
+
_, context = data
|
151
|
+
context
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
14
155
|
attr_reader :source
|
15
156
|
attr_reader :errors
|
16
157
|
attr_reader :typing
|
@@ -22,8 +163,9 @@ module Steep
|
|
22
163
|
attr_reader :root_context
|
23
164
|
attr_reader :method_calls
|
24
165
|
attr_reader :source_index
|
166
|
+
attr_reader :cursor_context
|
25
167
|
|
26
|
-
def initialize(source:, root_context:, parent: nil, parent_last_update: parent&.last_update,
|
168
|
+
def initialize(source:, root_context:, parent: nil, parent_last_update: parent&.last_update, source_index: nil, cursor:)
|
27
169
|
@source = source
|
28
170
|
|
29
171
|
@parent = parent
|
@@ -34,9 +176,13 @@ module Steep
|
|
34
176
|
@errors = []
|
35
177
|
(@typing = {}).compare_by_identity
|
36
178
|
@root_context = root_context
|
37
|
-
@contexts = contexts || TypeInference::ContextArray.from_source(source: source, context: root_context)
|
38
179
|
(@method_calls = {}).compare_by_identity
|
39
180
|
|
181
|
+
@cursor_context = CursorContext.new(cursor)
|
182
|
+
if root_context
|
183
|
+
cursor_context.set(0..source.buffer.content&.size || 0, root_context)
|
184
|
+
end
|
185
|
+
|
40
186
|
@source_index = source_index || Index::SourceIndex.new(source: source)
|
41
187
|
end
|
42
188
|
|
@@ -57,11 +203,6 @@ module Steep
|
|
57
203
|
call
|
58
204
|
end
|
59
205
|
|
60
|
-
def add_context(range, context:)
|
61
|
-
contexts.insert_context(range, context: context)
|
62
|
-
@last_update += 1
|
63
|
-
end
|
64
|
-
|
65
206
|
def has_type?(node)
|
66
207
|
typing.key?(node)
|
67
208
|
end
|
@@ -96,13 +237,6 @@ module Steep
|
|
96
237
|
end
|
97
238
|
end
|
98
239
|
|
99
|
-
def add_context_for_node(node, context:)
|
100
|
-
begin_pos = node.loc.expression.begin_pos
|
101
|
-
end_pos = node.loc.expression.end_pos
|
102
|
-
|
103
|
-
add_context(begin_pos..end_pos, context: context)
|
104
|
-
end
|
105
|
-
|
106
240
|
def block_range(node)
|
107
241
|
case node.type
|
108
242
|
when :block
|
@@ -110,98 +244,20 @@ module Steep
|
|
110
244
|
begin_pos = if send_node.type != :lambda && args_node.loc.expression
|
111
245
|
args_node.loc.expression.end_pos
|
112
246
|
else
|
113
|
-
node.loc.begin.end_pos
|
247
|
+
node.loc.begin.end_pos # steep:ignore NoMethod
|
114
248
|
end
|
115
|
-
end_pos = node.loc.end.begin_pos
|
249
|
+
end_pos = node.loc.end.begin_pos # steep:ignore NoMethod
|
116
250
|
when :numblock
|
117
251
|
send_node, _ = node.children
|
118
|
-
begin_pos = node.loc.begin.end_pos
|
119
|
-
end_pos = node.loc.end.begin_pos
|
252
|
+
begin_pos = node.loc.begin.end_pos # steep:ignore NoMethod
|
253
|
+
end_pos = node.loc.end.begin_pos # steep:ignore NoMethod
|
120
254
|
end
|
121
255
|
|
122
256
|
begin_pos..end_pos
|
123
257
|
end
|
124
258
|
|
125
|
-
def add_context_for_body(node, context:)
|
126
|
-
case node.type
|
127
|
-
when :class
|
128
|
-
name_node, super_node, _ = node.children
|
129
|
-
begin_pos = if super_node
|
130
|
-
super_node.loc.expression.end_pos
|
131
|
-
else
|
132
|
-
name_node.loc.expression.end_pos
|
133
|
-
end
|
134
|
-
end_pos = node.loc.end.begin_pos
|
135
|
-
|
136
|
-
add_context(begin_pos..end_pos, context: context)
|
137
|
-
|
138
|
-
when :module
|
139
|
-
name_node = node.children[0]
|
140
|
-
begin_pos = name_node.loc.expression.end_pos
|
141
|
-
end_pos = node.loc.end.begin_pos
|
142
|
-
add_context(begin_pos..end_pos, context: context)
|
143
|
-
|
144
|
-
when :sclass
|
145
|
-
name_node = node.children[0]
|
146
|
-
begin_pos = name_node.loc.expression.end_pos
|
147
|
-
end_pos = node.loc.end.begin_pos
|
148
|
-
add_context(begin_pos..end_pos, context: context)
|
149
|
-
|
150
|
-
when :def, :defs
|
151
|
-
if node.children.last
|
152
|
-
args_node =
|
153
|
-
case node.type
|
154
|
-
when :def
|
155
|
-
node.children[1]
|
156
|
-
when :defs
|
157
|
-
node.children[2]
|
158
|
-
end
|
159
|
-
|
160
|
-
body_begin_pos =
|
161
|
-
case
|
162
|
-
when node.loc.assignment
|
163
|
-
# endless def
|
164
|
-
node.loc.assignment.end_pos
|
165
|
-
when args_node.loc.expression
|
166
|
-
# with args
|
167
|
-
args_node.loc.expression.end_pos
|
168
|
-
else
|
169
|
-
# without args
|
170
|
-
node.loc.name.end_pos
|
171
|
-
end
|
172
|
-
|
173
|
-
body_end_pos =
|
174
|
-
if node.loc.end
|
175
|
-
node.loc.end.begin_pos
|
176
|
-
else
|
177
|
-
node.loc.expression.end_pos
|
178
|
-
end
|
179
|
-
|
180
|
-
add_context(body_begin_pos..body_end_pos, context: context)
|
181
|
-
end
|
182
|
-
|
183
|
-
when :block, :numblock
|
184
|
-
range = block_range(node)
|
185
|
-
add_context(range, context: context)
|
186
|
-
|
187
|
-
when :for
|
188
|
-
_, collection, _ = node.children
|
189
|
-
|
190
|
-
begin_pos = collection.loc.expression.end_pos
|
191
|
-
end_pos = node.loc.end.begin_pos
|
192
|
-
|
193
|
-
add_context(begin_pos..end_pos, context: context)
|
194
|
-
else
|
195
|
-
raise "Unexpected node for insert_context: #{node.type}"
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
def context_at(line:, column:)
|
200
|
-
contexts.at(line: line, column: column) ||
|
201
|
-
(parent ? parent.context_at(line: line, column: column) : root_context)
|
202
|
-
end
|
203
|
-
|
204
259
|
def dump(io)
|
260
|
+
# steep:ignore:start
|
205
261
|
io.puts "Typing: "
|
206
262
|
nodes.each_value do |node|
|
207
263
|
io.puts " #{Typing.summary(node)} => #{type_of(node: node).inspect}"
|
@@ -211,6 +267,7 @@ module Steep
|
|
211
267
|
errors.each do |error|
|
212
268
|
io.puts " #{Typing.summary(error.node)} => #{error.inspect}"
|
213
269
|
end
|
270
|
+
# steep:ignore:end
|
214
271
|
end
|
215
272
|
|
216
273
|
def self.summary(node)
|
@@ -221,13 +278,14 @@ module Steep
|
|
221
278
|
"#{line}:#{col}:#{src}"
|
222
279
|
end
|
223
280
|
|
224
|
-
def new_child(
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
281
|
+
def new_child()
|
282
|
+
child = self.class.new(
|
283
|
+
source: source,
|
284
|
+
parent: self,
|
285
|
+
root_context: root_context,
|
286
|
+
source_index: source_index.new_child,
|
287
|
+
cursor: cursor_context.index
|
288
|
+
)
|
231
289
|
@should_update = true
|
232
290
|
|
233
291
|
if block_given?
|
@@ -249,14 +307,14 @@ module Steep
|
|
249
307
|
parent.add_typing(node, type, nil)
|
250
308
|
end
|
251
309
|
|
252
|
-
parent.contexts.merge(contexts)
|
253
|
-
|
254
310
|
parent.method_calls.merge!(method_calls)
|
255
311
|
|
256
312
|
errors.each do |error|
|
257
313
|
parent.add_error error
|
258
314
|
end
|
259
315
|
|
316
|
+
parent.cursor_context.set(cursor_context)
|
317
|
+
|
260
318
|
parent.source_index.merge!(source_index)
|
261
319
|
end
|
262
320
|
end
|
data/lib/steep/version.rb
CHANGED
data/lib/steep.rb
CHANGED
@@ -15,6 +15,8 @@ require "stringio"
|
|
15
15
|
require 'uri'
|
16
16
|
require "yaml"
|
17
17
|
require "securerandom"
|
18
|
+
require "base64"
|
19
|
+
require "time"
|
18
20
|
|
19
21
|
require "concurrent/utility/processor_counter"
|
20
22
|
require "terminal-table"
|
@@ -22,11 +24,12 @@ require "terminal-table"
|
|
22
24
|
require "rbs"
|
23
25
|
|
24
26
|
require "steep/path_helper"
|
25
|
-
|
27
|
+
require "steep/located_value"
|
26
28
|
require "steep/thread_waiter"
|
27
29
|
require "steep/equatable"
|
28
30
|
require "steep/method_name"
|
29
31
|
require "steep/node_helper"
|
32
|
+
require "steep/ast/types/shared_instance"
|
30
33
|
require "steep/ast/types/helper"
|
31
34
|
require "steep/ast/types/any"
|
32
35
|
require "steep/ast/types/instance"
|
@@ -76,14 +79,13 @@ require "steep/diagnostic/ruby"
|
|
76
79
|
require "steep/diagnostic/signature"
|
77
80
|
require "steep/diagnostic/lsp_formatter"
|
78
81
|
require "steep/signature/validator"
|
82
|
+
require "steep/module_helper"
|
79
83
|
require "steep/source"
|
80
84
|
require "steep/source/ignore_ranges"
|
81
85
|
require "steep/annotation_parser"
|
82
86
|
require "steep/typing"
|
83
|
-
require "steep/module_helper"
|
84
87
|
require "steep/type_construction"
|
85
88
|
require "steep/type_inference/context"
|
86
|
-
require "steep/type_inference/context_array"
|
87
89
|
require "steep/type_inference/send_args"
|
88
90
|
require "steep/type_inference/block_params"
|
89
91
|
require "steep/type_inference/method_params"
|
@@ -113,6 +115,8 @@ require "steep/services/stats_calculator"
|
|
113
115
|
require "steep/services/file_loader"
|
114
116
|
require "steep/services/goto_service"
|
115
117
|
|
118
|
+
require "steep/server/custom_methods"
|
119
|
+
require "steep/server/work_done_progress"
|
116
120
|
require "steep/server/delay_queue"
|
117
121
|
require "steep/server/lsp_formatter"
|
118
122
|
require "steep/server/change_buffer"
|
@@ -160,7 +164,16 @@ module Steep
|
|
160
164
|
end
|
161
165
|
|
162
166
|
def self.new_logger(output, prev_level)
|
163
|
-
|
167
|
+
logger = Logger.new(output)
|
168
|
+
logger.formatter = proc do |severity, datetime, progname, msg|
|
169
|
+
# @type var severity: String
|
170
|
+
# @type var datetime: Time
|
171
|
+
# @type var progname: untyped
|
172
|
+
# @type var msg: untyped
|
173
|
+
# @type block: String
|
174
|
+
"#{datetime.strftime('%Y-%m-%d %H:%M:%S.%L')}: #{severity}: #{msg}\n"
|
175
|
+
end
|
176
|
+
ActiveSupport::TaggedLogging.new(logger).tap do |logger|
|
164
177
|
logger.push_tags "Steep #{VERSION}"
|
165
178
|
logger.level = prev_level || Logger::ERROR
|
166
179
|
end
|
@@ -339,3 +352,15 @@ module GCCounter
|
|
339
352
|
end
|
340
353
|
end
|
341
354
|
end
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
# klasses = [Set]
|
360
|
+
# klasses.each do |klass|
|
361
|
+
# # steep:ignore:start
|
362
|
+
# def klass.new(...)
|
363
|
+
# super
|
364
|
+
# end
|
365
|
+
# # steep:ignore:end
|
366
|
+
# end
|
data/steep.gemspec
CHANGED
@@ -29,14 +29,14 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
|
-
spec.required_ruby_version = '>= 3.
|
32
|
+
spec.required_ruby_version = '>= 3.1.0'
|
33
33
|
|
34
34
|
spec.add_runtime_dependency "parser", ">= 3.1"
|
35
35
|
spec.add_runtime_dependency "activesupport", ">= 5.1"
|
36
36
|
spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
|
37
37
|
spec.add_runtime_dependency "listen", "~> 3.0"
|
38
38
|
spec.add_runtime_dependency "language_server-protocol", ">= 3.15", "< 4.0"
|
39
|
-
spec.add_runtime_dependency "rbs", "
|
39
|
+
spec.add_runtime_dependency "rbs", "~> 3.6.0.dev"
|
40
40
|
spec.add_runtime_dependency "concurrent-ruby", ">= 1.1.10"
|
41
41
|
spec.add_runtime_dependency "terminal-table", ">= 2", "< 4"
|
42
42
|
spec.add_runtime_dependency "securerandom", ">= 0.1"
|
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: 1.8.0.
|
4
|
+
version: 1.8.0.pre.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: 2024-
|
11
|
+
date: 2024-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -96,16 +96,16 @@ dependencies:
|
|
96
96
|
name: rbs
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- - "
|
99
|
+
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 3.
|
101
|
+
version: 3.6.0.dev
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
|
-
- - "
|
106
|
+
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: 3.
|
108
|
+
version: 3.6.0.dev
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: concurrent-ruby
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,11 +240,15 @@ files:
|
|
240
240
|
- Rakefile
|
241
241
|
- Steepfile
|
242
242
|
- bin/console
|
243
|
+
- bin/mem_graph.rb
|
244
|
+
- bin/mem_prof.rb
|
243
245
|
- bin/output_rebaseline.rb
|
244
246
|
- bin/output_test.rb
|
245
247
|
- bin/rbs
|
246
248
|
- bin/setup
|
249
|
+
- bin/stackprof_test.rb
|
247
250
|
- bin/steep
|
251
|
+
- bin/steep-check.rb
|
248
252
|
- bin/steep-prof
|
249
253
|
- doc/narrowing.md
|
250
254
|
- doc/shape.md
|
@@ -276,6 +280,7 @@ files:
|
|
276
280
|
- lib/steep/ast/types/proc.rb
|
277
281
|
- lib/steep/ast/types/record.rb
|
278
282
|
- lib/steep/ast/types/self.rb
|
283
|
+
- lib/steep/ast/types/shared_instance.rb
|
279
284
|
- lib/steep/ast/types/top.rb
|
280
285
|
- lib/steep/ast/types/tuple.rb
|
281
286
|
- lib/steep/ast/types/union.rb
|
@@ -314,6 +319,7 @@ files:
|
|
314
319
|
- lib/steep/interface/shape.rb
|
315
320
|
- lib/steep/interface/substitution.rb
|
316
321
|
- lib/steep/interface/type_param.rb
|
322
|
+
- lib/steep/located_value.rb
|
317
323
|
- lib/steep/method_name.rb
|
318
324
|
- lib/steep/module_helper.rb
|
319
325
|
- lib/steep/node_helper.rb
|
@@ -327,11 +333,13 @@ files:
|
|
327
333
|
- lib/steep/range_extension.rb
|
328
334
|
- lib/steep/server/base_worker.rb
|
329
335
|
- lib/steep/server/change_buffer.rb
|
336
|
+
- lib/steep/server/custom_methods.rb
|
330
337
|
- lib/steep/server/delay_queue.rb
|
331
338
|
- lib/steep/server/interaction_worker.rb
|
332
339
|
- lib/steep/server/lsp_formatter.rb
|
333
340
|
- lib/steep/server/master.rb
|
334
341
|
- lib/steep/server/type_check_worker.rb
|
342
|
+
- lib/steep/server/work_done_progress.rb
|
335
343
|
- lib/steep/server/worker_process.rb
|
336
344
|
- lib/steep/services/completion_provider.rb
|
337
345
|
- lib/steep/services/content_change.rb
|
@@ -362,7 +370,6 @@ files:
|
|
362
370
|
- lib/steep/type_inference/case_when.rb
|
363
371
|
- lib/steep/type_inference/constant_env.rb
|
364
372
|
- lib/steep/type_inference/context.rb
|
365
|
-
- lib/steep/type_inference/context_array.rb
|
366
373
|
- lib/steep/type_inference/logic_type_interpreter.rb
|
367
374
|
- lib/steep/type_inference/method_call.rb
|
368
375
|
- lib/steep/type_inference/method_params.rb
|
@@ -394,14 +401,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
394
401
|
requirements:
|
395
402
|
- - ">="
|
396
403
|
- !ruby/object:Gem::Version
|
397
|
-
version: 3.
|
404
|
+
version: 3.1.0
|
398
405
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
399
406
|
requirements:
|
400
407
|
- - ">="
|
401
408
|
- !ruby/object:Gem::Version
|
402
409
|
version: '0'
|
403
410
|
requirements: []
|
404
|
-
rubygems_version: 3.5.
|
411
|
+
rubygems_version: 3.5.17
|
405
412
|
signing_key:
|
406
413
|
specification_version: 4
|
407
414
|
summary: Gradual Typing for Ruby
|