steep 0.30.0 → 0.34.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 +26 -0
- data/bin/steep-prof +1 -2
- data/lib/steep.rb +3 -2
- data/lib/steep/annotation_parser.rb +1 -1
- data/lib/steep/ast/types/factory.rb +79 -60
- data/lib/steep/cli.rb +14 -1
- data/lib/steep/drivers/stats.rb +85 -0
- data/lib/steep/errors.rb +19 -15
- data/lib/steep/interface/method_type.rb +12 -23
- data/lib/steep/method_name.rb +28 -0
- data/lib/steep/project/completion_provider.rb +33 -22
- data/lib/steep/project/hover_content.rb +91 -80
- data/lib/steep/project/source_file.rb +2 -1
- data/lib/steep/server/interaction_worker.rb +43 -39
- data/lib/steep/server/utils.rb +1 -1
- data/lib/steep/source.rb +60 -3
- data/lib/steep/subtyping/variable_occurrence.rb +2 -0
- data/lib/steep/type_construction.rb +577 -415
- data/lib/steep/type_inference/context.rb +7 -3
- data/lib/steep/type_inference/context_array.rb +1 -1
- data/lib/steep/type_inference/local_variable_type_env.rb +10 -1
- data/lib/steep/type_inference/logic_type_interpreter.rb +6 -0
- data/lib/steep/type_inference/method_call.rb +116 -0
- data/lib/steep/typing.rb +38 -8
- data/lib/steep/version.rb +1 -1
- data/smoke/regression/fun.rb +8 -0
- data/smoke/regression/fun.rbs +4 -0
- data/smoke/regression/range.rb +5 -0
- data/steep.gemspec +2 -2
- metadata +12 -8
- data/lib/steep/ast/buffer.rb +0 -51
- data/lib/steep/ast/location.rb +0 -86
data/lib/steep/ast/location.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
module Steep
|
2
|
-
module AST
|
3
|
-
class Location
|
4
|
-
attr_reader :buffer
|
5
|
-
attr_reader :start_pos
|
6
|
-
attr_reader :end_pos
|
7
|
-
|
8
|
-
def initialize(buffer:, start_pos:, end_pos:)
|
9
|
-
@buffer = buffer
|
10
|
-
@start_pos = start_pos
|
11
|
-
@end_pos = end_pos
|
12
|
-
end
|
13
|
-
|
14
|
-
def inspect
|
15
|
-
"#<#{self.class}:#{self.__id__} @buffer=#{buffer.name}, @start_pos=#{start_pos}, @end_pos=#{end_pos}, source='#{source.lines.first}', start_line=#{start_line}, start_column=#{start_column}>"
|
16
|
-
end
|
17
|
-
|
18
|
-
def name
|
19
|
-
buffer.name
|
20
|
-
end
|
21
|
-
|
22
|
-
def start_line
|
23
|
-
start_loc[0]
|
24
|
-
end
|
25
|
-
|
26
|
-
def start_column
|
27
|
-
start_loc[1]
|
28
|
-
end
|
29
|
-
|
30
|
-
def end_line
|
31
|
-
end_loc[0]
|
32
|
-
end
|
33
|
-
|
34
|
-
def end_column
|
35
|
-
end_loc[1]
|
36
|
-
end
|
37
|
-
|
38
|
-
def start_loc
|
39
|
-
@start_loc ||= buffer.pos_to_loc(start_pos)
|
40
|
-
end
|
41
|
-
|
42
|
-
def end_loc
|
43
|
-
@end_loc ||= buffer.pos_to_loc(end_pos)
|
44
|
-
end
|
45
|
-
|
46
|
-
def source
|
47
|
-
@source ||= buffer.source(start_pos...end_pos)
|
48
|
-
end
|
49
|
-
|
50
|
-
def to_s
|
51
|
-
"#{start_line}:#{start_column}...#{end_line}:#{end_column}"
|
52
|
-
end
|
53
|
-
|
54
|
-
def ==(other)
|
55
|
-
other.is_a?(Location) &&
|
56
|
-
other.buffer == buffer &&
|
57
|
-
other.start_pos == start_pos &&
|
58
|
-
other.end_pos == end_pos
|
59
|
-
end
|
60
|
-
|
61
|
-
def +(other)
|
62
|
-
if other
|
63
|
-
raise "Invalid concat: buffer=#{buffer.name}, other.buffer=#{other.buffer.name}" unless other.buffer == buffer
|
64
|
-
|
65
|
-
self.class.new(buffer: buffer,
|
66
|
-
start_pos: start_pos,
|
67
|
-
end_pos: other.end_pos)
|
68
|
-
else
|
69
|
-
self
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.concat(*locations)
|
74
|
-
locations.inject {|l1, l2|
|
75
|
-
l1 + l2
|
76
|
-
}
|
77
|
-
end
|
78
|
-
|
79
|
-
def pred?(loc)
|
80
|
-
loc.is_a?(Location) &&
|
81
|
-
loc.name == name &&
|
82
|
-
loc.start_pos == end_pos
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|