steep 1.7.0.dev.2 → 1.7.0.dev.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +10 -12
  3. data/gemfile_steep/Gemfile.lock +8 -10
  4. data/lib/steep/ast/types/helper.rb +4 -0
  5. data/lib/steep/ast/types/intersection.rb +7 -0
  6. data/lib/steep/ast/types/record.rb +7 -0
  7. data/lib/steep/ast/types/tuple.rb +7 -0
  8. data/lib/steep/ast/types/union.rb +7 -0
  9. data/lib/steep/drivers/stats.rb +2 -2
  10. data/lib/steep/drivers/validate.rb +4 -2
  11. data/lib/steep/expectations.rb +2 -2
  12. data/lib/steep/interface/builder.rb +336 -360
  13. data/lib/steep/interface/function.rb +69 -6
  14. data/lib/steep/interface/method_type.rb +3 -3
  15. data/lib/steep/interface/shape.rb +69 -18
  16. data/lib/steep/interface/substitution.rb +4 -0
  17. data/lib/steep/node_helper.rb +18 -1
  18. data/lib/steep/services/completion_provider.rb +19 -17
  19. data/lib/steep/services/signature_help_provider.rb +6 -9
  20. data/lib/steep/subtyping/check.rb +4 -16
  21. data/lib/steep/test.rb +9 -0
  22. data/lib/steep/type_construction.rb +13 -9
  23. data/lib/steep/type_inference/block_params.rb +11 -3
  24. data/lib/steep/type_inference/context.rb +1 -1
  25. data/lib/steep/type_inference/logic_type_interpreter.rb +1 -1
  26. data/lib/steep/version.rb +1 -1
  27. data/lib/steep.rb +11 -7
  28. data/sig/steep/ast/types/helper.rbs +2 -0
  29. data/sig/steep/ast/types/intersection.rbs +2 -0
  30. data/sig/steep/ast/types/name.rbs +4 -0
  31. data/sig/steep/ast/types/record.rbs +2 -0
  32. data/sig/steep/ast/types/tuple.rbs +2 -0
  33. data/sig/steep/ast/types/union.rbs +2 -0
  34. data/sig/steep/expectations.rbs +1 -1
  35. data/sig/steep/interface/block.rbs +2 -2
  36. data/sig/steep/interface/builder.rbs +94 -108
  37. data/sig/steep/interface/function.rbs +34 -29
  38. data/sig/steep/interface/shape.rbs +23 -4
  39. data/sig/steep/interface/substitution.rbs +2 -0
  40. data/sig/steep/node_helper.rbs +11 -0
  41. data/sig/steep/services/signature_help_provider.rbs +2 -0
  42. data/sig/steep/subtyping/constraints.rbs +2 -2
  43. data/sig/steep/type_construction.rbs +1 -1
  44. data/sig/steep/type_inference/block_params.rbs +2 -2
  45. data/sig/steep/type_inference/context.rbs +2 -0
  46. data/sig/steep.rbs +1 -1
  47. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0646b6c1cb596e684bc62461ee2dac160e134bc7e126f447df8f6e46a535c8b6
4
- data.tar.gz: fda1f8d1903253537fec79679dd88f3579404372d4fc611a0d4b9d085e5b3502
3
+ metadata.gz: c30f769d118a31c069ae146f976dc3df96b71acfa50659e6f03b00bdc1624da7
4
+ data.tar.gz: '064953d68e749654f069f2ea215746366a58506406ec5977826f5cf73552f779'
5
5
  SHA512:
6
- metadata.gz: 46fe48e86a4fe74482765debeb255e1b806298fb797603ebf292443432506e80ac7ffb7aa964b6331e4f71d2f4e607379340834a6f66866d75bc8c0ca4b73633
7
- data.tar.gz: c822e0bf8a0484914423ece12d3d38bebf4102d6f63b1eb79f779cc3bf8aa9b909d34b189a594cf5d0a4f607ed0474d7b9bb2ed6a6c6d400212e329f4d5a8e96
6
+ metadata.gz: 4ce31d8368b84b72284eb331606a6f1c15b3843a2c13a01770bcac35c4f9fa35ab5a62617a4d13c913c482b1775fc043265a8fbdb5a58e7598e9ad92a2246fda
7
+ data.tar.gz: 206491dcd015533b092afe61277f48e28e288693c9ffadaa85aa855b0616ab9f64ba7001b297a7387432fec3492aed55f16ac5ebba3b379cb7bf79575249700c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- steep (1.7.0.dev.2)
4
+ steep (1.7.0.dev.3)
5
5
  activesupport (>= 5.1)
6
6
  concurrent-ruby (>= 1.1.10)
7
7
  csv (>= 3.0.9)
@@ -33,30 +33,29 @@ GEM
33
33
  tzinfo (~> 2.0)
34
34
  ast (2.4.2)
35
35
  base64 (0.2.0)
36
- bigdecimal (3.1.6)
36
+ bigdecimal (3.1.7)
37
37
  concurrent-ruby (1.2.3)
38
38
  connection_pool (2.4.1)
39
- csv (3.2.8)
39
+ csv (3.3.0)
40
40
  debug (1.9.1)
41
41
  irb (~> 1.10)
42
42
  reline (>= 0.3.8)
43
- drb (2.2.0)
44
- ruby2_keywords
43
+ drb (2.2.1)
45
44
  ffi (1.16.3)
46
45
  fileutils (1.7.2)
47
- i18n (1.14.1)
46
+ i18n (1.14.4)
48
47
  concurrent-ruby (~> 1.0)
49
48
  io-console (0.7.2)
50
- irb (1.11.1)
49
+ irb (1.12.0)
51
50
  rdoc
52
51
  reline (>= 0.4.2)
53
52
  json (2.7.1)
54
53
  language_server-protocol (3.17.0.3)
55
- listen (3.8.0)
54
+ listen (3.9.0)
56
55
  rb-fsevent (~> 0.10, >= 0.10.3)
57
56
  rb-inotify (~> 0.9, >= 0.9.10)
58
57
  logger (1.6.0)
59
- minitest (5.22.2)
58
+ minitest (5.22.3)
60
59
  minitest-hooks (1.5.1)
61
60
  minitest (> 5.3)
62
61
  minitest-slow_test (0.2.0)
@@ -75,11 +74,10 @@ GEM
75
74
  ffi (~> 1.0)
76
75
  rbs (3.4.4)
77
76
  abbrev
78
- rdoc (6.6.2)
77
+ rdoc (6.6.3.1)
79
78
  psych (>= 4.0.0)
80
- reline (0.4.2)
79
+ reline (0.4.3)
81
80
  io-console (~> 0.5)
82
- ruby2_keywords (0.0.5)
83
81
  securerandom (0.3.1)
84
82
  stackprof (0.2.26)
85
83
  stringio (3.1.0)
@@ -2,7 +2,7 @@ GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
4
  abbrev (0.1.2)
5
- activesupport (7.1.3)
5
+ activesupport (7.1.3.2)
6
6
  base64
7
7
  bigdecimal
8
8
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -14,23 +14,22 @@ GEM
14
14
  tzinfo (~> 2.0)
15
15
  ast (2.4.2)
16
16
  base64 (0.2.0)
17
- bigdecimal (3.1.6)
17
+ bigdecimal (3.1.7)
18
18
  concurrent-ruby (1.2.3)
19
19
  connection_pool (2.4.1)
20
- csv (3.2.8)
21
- drb (2.2.0)
22
- ruby2_keywords
20
+ csv (3.3.0)
21
+ drb (2.2.1)
23
22
  ffi (1.16.3)
24
23
  fileutils (1.7.2)
25
- i18n (1.14.1)
24
+ i18n (1.14.4)
26
25
  concurrent-ruby (~> 1.0)
27
26
  json (2.7.1)
28
27
  language_server-protocol (3.17.0.3)
29
- listen (3.8.0)
28
+ listen (3.9.0)
30
29
  rb-fsevent (~> 0.10, >= 0.10.3)
31
30
  rb-inotify (~> 0.9, >= 0.9.10)
32
31
  logger (1.6.0)
33
- minitest (5.22.2)
32
+ minitest (5.22.3)
34
33
  mutex_m (0.2.0)
35
34
  parser (3.3.0.5)
36
35
  ast (~> 2.4.1)
@@ -42,9 +41,8 @@ GEM
42
41
  ffi (~> 1.0)
43
42
  rbs (3.4.4)
44
43
  abbrev
45
- ruby2_keywords (0.0.5)
46
44
  securerandom (0.3.1)
47
- steep (1.7.0.dev.1)
45
+ steep (1.7.0.dev.2)
48
46
  activesupport (>= 5.1)
49
47
  concurrent-ruby (>= 1.1.10)
50
48
  csv (>= 3.0.9)
@@ -29,6 +29,10 @@ module Steep
29
29
  enum_for :each_child
30
30
  end
31
31
  end
32
+
33
+ def map_type
34
+ self
35
+ end
32
36
  end
33
37
  end
34
38
  end
@@ -80,6 +80,13 @@ module Steep
80
80
  end
81
81
  end
82
82
 
83
+ def map_type(&block)
84
+ self.class.build(
85
+ types: each_child.map(&block),
86
+ location: location
87
+ )
88
+ end
89
+
83
90
  def level
84
91
  [0] + level_of_children(types)
85
92
  end
@@ -50,6 +50,13 @@ module Steep
50
50
  end
51
51
  end
52
52
 
53
+ def map_type(&block)
54
+ self.class.new(
55
+ elements: elements.transform_values(&block),
56
+ location: location
57
+ )
58
+ end
59
+
53
60
  def level
54
61
  [0] + level_of_children(elements.values)
55
62
  end
@@ -46,6 +46,13 @@ module Steep
46
46
  end
47
47
  end
48
48
 
49
+ def map_type(&block)
50
+ Tuple.new(
51
+ types: types.map(&block),
52
+ location: location
53
+ )
54
+ end
55
+
49
56
  def level
50
57
  [0] + level_of_children(types)
51
58
  end
@@ -80,6 +80,13 @@ module Steep
80
80
  end
81
81
  end
82
82
 
83
+ def map_type(&block)
84
+ Union.build(
85
+ types: types.map(&block),
86
+ location: location
87
+ )
88
+ end
89
+
83
90
  include Helper::ChildrenLevel
84
91
 
85
92
  def level
@@ -83,7 +83,7 @@ module Steep
83
83
  end
84
84
  end
85
85
 
86
- table = Terminal::Table.new(
86
+ table = Terminal::Table.new( # steep:ignore UnknownConstant
87
87
  headings: ["Target", "File", "Status", "Typed calls", "Untyped calls", "All calls", "Typed %"],
88
88
  rows: rows
89
89
  )
@@ -166,7 +166,7 @@ module Steep
166
166
  {
167
167
  id: stats_id,
168
168
  method: "workspace/executeCommand",
169
- params: { command: "steep/stats", arguments: [] }
169
+ params: { command: "steep/stats", arguments: _ = [] }
170
170
  })
171
171
 
172
172
  stats_response = wait_for_response_id(reader: client_reader, id: stats_id)
@@ -49,8 +49,10 @@ module Steep
49
49
  if buffer
50
50
  printer = DiagnosticPrinter.new(stdout: stdout, buffer: buffer)
51
51
  ds.each do |d|
52
- printer.print(d)
53
- stdout.puts
52
+ if d
53
+ printer.print(_ = d)
54
+ stdout.puts
55
+ end
54
56
  end
55
57
  end
56
58
  end
@@ -23,7 +23,7 @@ module Steep
23
23
  :information
24
24
  when "HINT"
25
25
  :hint
26
- end #: Diagnostic::LSPFormatter::severity
26
+ end #: Steep::Diagnostic::LSPFormatter::severity
27
27
 
28
28
  Diagnostic.new(
29
29
  start_position: start_position,
@@ -56,7 +56,7 @@ module Steep
56
56
  :hint
57
57
  else
58
58
  :error
59
- end #: Diagnostic::LSPFormatter::severity
59
+ end #: Steep::Diagnostic::LSPFormatter::severity
60
60
 
61
61
  Diagnostic.new(
62
62
  start_position: start_position,