steep 0.31.0 → 0.35.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/lib/steep.rb +3 -2
  4. data/lib/steep/annotation_parser.rb +1 -1
  5. data/lib/steep/ast/types/factory.rb +66 -60
  6. data/lib/steep/cli.rb +15 -2
  7. data/lib/steep/drivers/print_project.rb +11 -0
  8. data/lib/steep/drivers/stats.rb +85 -0
  9. data/lib/steep/drivers/vendor.rb +1 -20
  10. data/lib/steep/errors.rb +19 -15
  11. data/lib/steep/interface/method_type.rb +12 -23
  12. data/lib/steep/method_name.rb +28 -0
  13. data/lib/steep/project/completion_provider.rb +24 -15
  14. data/lib/steep/project/dsl.rb +13 -17
  15. data/lib/steep/project/options.rb +4 -4
  16. data/lib/steep/project/source_file.rb +2 -1
  17. data/lib/steep/project/target.rb +19 -10
  18. data/lib/steep/server/interaction_worker.rb +1 -1
  19. data/lib/steep/server/utils.rb +1 -1
  20. data/lib/steep/source.rb +3 -3
  21. data/lib/steep/subtyping/check.rb +30 -16
  22. data/lib/steep/subtyping/variable_occurrence.rb +2 -0
  23. data/lib/steep/type_construction.rb +585 -416
  24. data/lib/steep/type_inference/context.rb +7 -3
  25. data/lib/steep/type_inference/context_array.rb +1 -1
  26. data/lib/steep/type_inference/local_variable_type_env.rb +10 -1
  27. data/lib/steep/type_inference/logic_type_interpreter.rb +6 -0
  28. data/lib/steep/type_inference/method_call.rb +116 -0
  29. data/lib/steep/typing.rb +38 -8
  30. data/lib/steep/version.rb +1 -1
  31. data/smoke/regression/fun.rb +8 -0
  32. data/smoke/regression/fun.rbs +4 -0
  33. data/smoke/regression/range.rb +5 -0
  34. data/steep.gemspec +1 -1
  35. metadata +10 -6
  36. data/lib/steep/ast/buffer.rb +0 -51
  37. data/lib/steep/ast/location.rb +0 -86
@@ -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