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
@@ -1,112 +0,0 @@
|
|
1
|
-
module Steep
|
2
|
-
module TypeInference
|
3
|
-
class ContextArray
|
4
|
-
class Entry
|
5
|
-
attr_reader :range, :context, :sub_entries
|
6
|
-
|
7
|
-
def initialize(range:, context:)
|
8
|
-
@range = range
|
9
|
-
@context = context
|
10
|
-
@sub_entries = Set[].compare_by_identity
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
attr_reader :buffer
|
15
|
-
attr_reader :root
|
16
|
-
|
17
|
-
def initialize(buffer:, context:, range: 0..buffer.content.size)
|
18
|
-
@buffer = buffer
|
19
|
-
@root = Entry.new(range: range, context: context)
|
20
|
-
end
|
21
|
-
|
22
|
-
def range
|
23
|
-
root.range
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.from_source(source:, range: nil, context:)
|
27
|
-
content = if source.node
|
28
|
-
source.node.location.expression.source_buffer.source
|
29
|
-
else
|
30
|
-
""
|
31
|
-
end
|
32
|
-
buffer = RBS::Buffer.new(name: source.path, content: content)
|
33
|
-
range ||= 0..buffer.content.size
|
34
|
-
new(buffer: buffer, context: context, range: range)
|
35
|
-
end
|
36
|
-
|
37
|
-
def insert_context(range, context:, entry: self.root)
|
38
|
-
entry.sub_entries.each do |sub|
|
39
|
-
next if sub.range.begin <= range.begin && range.end <= sub.range.end
|
40
|
-
next if range.begin <= sub.range.begin && sub.range.end <= range.end
|
41
|
-
next if range.end <= sub.range.begin
|
42
|
-
next if sub.range.end <= range.begin
|
43
|
-
|
44
|
-
Steep.logger.error { "Range crossing: sub range=#{sub.range}, new range=#{range}" }
|
45
|
-
raise
|
46
|
-
end
|
47
|
-
|
48
|
-
sup = entry.sub_entries.find do |sub|
|
49
|
-
sub.range.begin < range.begin && range.end <= sub.range.end
|
50
|
-
end
|
51
|
-
|
52
|
-
if sup
|
53
|
-
insert_context(range, context: context, entry: sup)
|
54
|
-
else
|
55
|
-
subs = entry.sub_entries.select do |sub|
|
56
|
-
range.begin < sub.range.begin && sub.range.end <= range.end
|
57
|
-
end
|
58
|
-
|
59
|
-
new_entry = Entry.new(range: range, context: context)
|
60
|
-
entry.sub_entries.subtract(subs)
|
61
|
-
new_entry.sub_entries.merge(subs)
|
62
|
-
entry.sub_entries << new_entry
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def each_entry(&block)
|
67
|
-
if block
|
68
|
-
es = [root]
|
69
|
-
|
70
|
-
while e = es.pop
|
71
|
-
es.push(*e.sub_entries.to_a)
|
72
|
-
|
73
|
-
yield e
|
74
|
-
end
|
75
|
-
else
|
76
|
-
enum_for :each_entry
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def context_at(index, entry: self.root)
|
81
|
-
return nil if index < entry.range.begin || entry.range.end < index
|
82
|
-
|
83
|
-
sub = entry.sub_entries.find do |sub|
|
84
|
-
sub.range.begin <= index && index <= sub.range.end
|
85
|
-
end
|
86
|
-
|
87
|
-
if sub
|
88
|
-
context_at(index, entry: sub)
|
89
|
-
else
|
90
|
-
entry.context
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def [](index)
|
95
|
-
context_at(index)
|
96
|
-
end
|
97
|
-
|
98
|
-
def at(line:, column:)
|
99
|
-
pos = buffer.loc_to_pos([line, column])
|
100
|
-
self[pos]
|
101
|
-
end
|
102
|
-
|
103
|
-
def merge(subtree)
|
104
|
-
subtree.each_entry do |entry|
|
105
|
-
if entry.context
|
106
|
-
insert_context entry.range, context: entry.context
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|