steep 0.39.0 → 0.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/CHANGELOG.md +6 -0
  4. data/Rakefile +5 -2
  5. data/bin/output_rebaseline.rb +49 -0
  6. data/bin/output_test.rb +93 -0
  7. data/lib/steep.rb +8 -3
  8. data/lib/steep/cli.rb +1 -1
  9. data/lib/steep/diagnostic/helper.rb +17 -0
  10. data/lib/steep/diagnostic/lsp_formatter.rb +16 -0
  11. data/lib/steep/diagnostic/ruby.rb +623 -0
  12. data/lib/steep/diagnostic/signature.rb +224 -0
  13. data/lib/steep/drivers/annotations.rb +13 -6
  14. data/lib/steep/drivers/check.rb +83 -60
  15. data/lib/steep/drivers/diagnostic_printer.rb +94 -0
  16. data/lib/steep/drivers/stats.rb +125 -29
  17. data/lib/steep/drivers/trace_printer.rb +5 -1
  18. data/lib/steep/drivers/validate.rb +13 -6
  19. data/lib/steep/drivers/watch.rb +26 -9
  20. data/lib/steep/drivers/worker.rb +5 -0
  21. data/lib/steep/project/options.rb +4 -4
  22. data/lib/steep/project/signature_file.rb +8 -2
  23. data/lib/steep/project/stats_calculator.rb +80 -0
  24. data/lib/steep/project/target.rb +64 -53
  25. data/lib/steep/range_extension.rb +29 -0
  26. data/lib/steep/server/base_worker.rb +42 -4
  27. data/lib/steep/server/code_worker.rb +37 -24
  28. data/lib/steep/server/interaction_worker.rb +1 -0
  29. data/lib/steep/server/master.rb +268 -82
  30. data/lib/steep/server/signature_worker.rb +7 -59
  31. data/lib/steep/server/worker_process.rb +9 -9
  32. data/lib/steep/signature/validator.rb +33 -9
  33. data/lib/steep/type_construction.rb +276 -194
  34. data/lib/steep/version.rb +1 -1
  35. data/smoke/alias/a.rb +0 -3
  36. data/smoke/alias/b.rb +0 -1
  37. data/smoke/alias/c.rb +0 -2
  38. data/smoke/alias/test.yaml +73 -0
  39. data/smoke/and/a.rb +0 -3
  40. data/smoke/and/test.yaml +24 -0
  41. data/smoke/array/a.rb +0 -3
  42. data/smoke/array/b.rb +0 -2
  43. data/smoke/array/c.rb +0 -1
  44. data/smoke/array/test.yaml +80 -0
  45. data/smoke/block/a.rb +0 -2
  46. data/smoke/block/b.rb +0 -2
  47. data/smoke/block/d.rb +0 -4
  48. data/smoke/block/test.yaml +96 -0
  49. data/smoke/broken/Steepfile +5 -0
  50. data/smoke/broken/broken.rb +0 -0
  51. data/smoke/broken/broken.rbs +0 -0
  52. data/smoke/broken/test.yaml +6 -0
  53. data/smoke/case/a.rb +0 -3
  54. data/smoke/case/test.yaml +36 -0
  55. data/smoke/class/a.rb +0 -3
  56. data/smoke/class/c.rb +0 -1
  57. data/smoke/class/f.rb +0 -1
  58. data/smoke/class/g.rb +0 -2
  59. data/smoke/class/i.rb +0 -2
  60. data/smoke/class/test.yaml +89 -0
  61. data/smoke/const/a.rb +0 -3
  62. data/smoke/const/b.rb +7 -0
  63. data/smoke/const/b.rbs +5 -0
  64. data/smoke/const/test.yaml +96 -0
  65. data/smoke/diagnostics-rbs-duplicated/Steepfile +5 -0
  66. data/smoke/diagnostics-rbs-duplicated/a.rbs +5 -0
  67. data/smoke/diagnostics-rbs-duplicated/test.yaml +10 -0
  68. data/smoke/diagnostics-rbs/Steepfile +5 -0
  69. data/smoke/diagnostics-rbs/duplicated-method-definition.rbs +20 -0
  70. data/smoke/diagnostics-rbs/generic-parameter-mismatch.rbs +7 -0
  71. data/smoke/diagnostics-rbs/invalid-method-overload.rbs +3 -0
  72. data/smoke/diagnostics-rbs/invalid-type-application.rbs +7 -0
  73. data/smoke/diagnostics-rbs/invalid_variance_annotation.rbs +3 -0
  74. data/smoke/diagnostics-rbs/recursive-alias.rbs +5 -0
  75. data/smoke/diagnostics-rbs/recursive-class.rbs +8 -0
  76. data/smoke/diagnostics-rbs/superclass-mismatch.rbs +7 -0
  77. data/smoke/diagnostics-rbs/test.yaml +142 -0
  78. data/smoke/diagnostics-rbs/unknown-method-alias.rbs +3 -0
  79. data/smoke/diagnostics-rbs/unknown-type-name.rbs +13 -0
  80. data/smoke/diagnostics/Steepfile +5 -0
  81. data/smoke/diagnostics/a.rbs +26 -0
  82. data/smoke/diagnostics/argument_type_mismatch.rb +1 -0
  83. data/smoke/diagnostics/block_body_type_mismatch.rb +1 -0
  84. data/smoke/diagnostics/block_type_mismatch.rb +3 -0
  85. data/smoke/diagnostics/break_type_mismatch.rb +1 -0
  86. data/smoke/diagnostics/else_on_exhaustive_case.rb +12 -0
  87. data/smoke/diagnostics/incompatible_annotation.rb +6 -0
  88. data/smoke/diagnostics/incompatible_argument.rb +1 -0
  89. data/smoke/diagnostics/incompatible_assignment.rb +8 -0
  90. data/smoke/diagnostics/method_arity_mismatch.rb +11 -0
  91. data/smoke/diagnostics/method_body_type_mismatch.rb +6 -0
  92. data/smoke/diagnostics/method_definition_missing.rb +2 -0
  93. data/smoke/diagnostics/method_return_type_annotation_mismatch.rb +7 -0
  94. data/smoke/diagnostics/missing_keyword.rb +1 -0
  95. data/smoke/diagnostics/no_method.rb +1 -0
  96. data/smoke/diagnostics/required_block_missing.rb +1 -0
  97. data/smoke/diagnostics/return_type_mismatch.rb +6 -0
  98. data/smoke/diagnostics/test.yaml +333 -0
  99. data/smoke/diagnostics/unexpected_block_given.rb +1 -0
  100. data/smoke/diagnostics/unexpected_dynamic_method.rb +3 -0
  101. data/smoke/diagnostics/unexpected_jump.rb +4 -0
  102. data/smoke/diagnostics/unexpected_jump_value.rb +3 -0
  103. data/smoke/diagnostics/unexpected_keyword.rb +1 -0
  104. data/smoke/diagnostics/unexpected_splat.rb +1 -0
  105. data/smoke/diagnostics/unexpected_yield.rb +6 -0
  106. data/smoke/diagnostics/unknown_constant_assigned.rb +7 -0
  107. data/smoke/diagnostics/unresolved_overloading.rb +1 -0
  108. data/smoke/diagnostics/unsatisfiable_constraint.rb +7 -0
  109. data/smoke/diagnostics/unsupported_syntax.rb +2 -0
  110. data/smoke/dstr/a.rb +0 -1
  111. data/smoke/dstr/test.yaml +10 -0
  112. data/smoke/ensure/a.rb +0 -4
  113. data/smoke/ensure/test.yaml +47 -0
  114. data/smoke/enumerator/a.rb +0 -6
  115. data/smoke/enumerator/b.rb +0 -3
  116. data/smoke/enumerator/test.yaml +100 -0
  117. data/smoke/extension/a.rb +0 -1
  118. data/smoke/extension/b.rb +0 -2
  119. data/smoke/extension/c.rb +0 -1
  120. data/smoke/extension/test.yaml +50 -0
  121. data/smoke/hash/b.rb +0 -1
  122. data/smoke/hash/c.rb +0 -3
  123. data/smoke/hash/d.rb +0 -1
  124. data/smoke/hash/e.rb +0 -1
  125. data/smoke/hash/test.yaml +62 -0
  126. data/smoke/hello/hello.rb +0 -2
  127. data/smoke/hello/test.yaml +18 -0
  128. data/smoke/if/a.rb +0 -2
  129. data/smoke/if/test.yaml +27 -0
  130. data/smoke/implements/a.rb +0 -2
  131. data/smoke/implements/test.yaml +16 -0
  132. data/smoke/initialize/test.yaml +4 -0
  133. data/smoke/integer/a.rb +0 -7
  134. data/smoke/integer/test.yaml +66 -0
  135. data/smoke/interface/a.rb +0 -2
  136. data/smoke/interface/test.yaml +16 -0
  137. data/smoke/kwbegin/a.rb +0 -1
  138. data/smoke/kwbegin/test.yaml +14 -0
  139. data/smoke/lambda/a.rb +1 -4
  140. data/smoke/lambda/test.yaml +28 -0
  141. data/smoke/literal/a.rb +0 -5
  142. data/smoke/literal/b.rb +0 -2
  143. data/smoke/literal/test.yaml +79 -0
  144. data/smoke/map/test.yaml +4 -0
  145. data/smoke/method/a.rb +0 -5
  146. data/smoke/method/b.rb +0 -1
  147. data/smoke/method/test.yaml +71 -0
  148. data/smoke/module/a.rb +0 -2
  149. data/smoke/module/b.rb +0 -2
  150. data/smoke/module/c.rb +0 -1
  151. data/smoke/module/d.rb +0 -1
  152. data/smoke/module/f.rb +0 -2
  153. data/smoke/module/test.yaml +51 -0
  154. data/smoke/regexp/a.rb +0 -38
  155. data/smoke/regexp/b.rb +0 -26
  156. data/smoke/regexp/test.yaml +372 -0
  157. data/smoke/regression/set_divide.rb +0 -4
  158. data/smoke/regression/test.yaml +38 -0
  159. data/smoke/rescue/a.rb +0 -5
  160. data/smoke/rescue/test.yaml +60 -0
  161. data/smoke/self/a.rb +0 -2
  162. data/smoke/self/test.yaml +16 -0
  163. data/smoke/skip/skip.rb +0 -2
  164. data/smoke/skip/test.yaml +16 -0
  165. data/smoke/stdout/test.yaml +4 -0
  166. data/smoke/super/a.rb +0 -4
  167. data/smoke/super/test.yaml +52 -0
  168. data/smoke/toplevel/a.rb +0 -1
  169. data/smoke/toplevel/test.yaml +12 -0
  170. data/smoke/tsort/a.rb +0 -3
  171. data/smoke/tsort/test.yaml +32 -0
  172. data/smoke/type_case/a.rb +0 -4
  173. data/smoke/type_case/test.yaml +33 -0
  174. data/smoke/yield/a.rb +0 -3
  175. data/smoke/yield/b.rb +6 -0
  176. data/smoke/yield/test.yaml +49 -0
  177. data/steep.gemspec +3 -3
  178. metadata +108 -17
  179. data/bin/smoke_runner.rb +0 -139
  180. data/lib/steep/drivers/signature_error_printer.rb +0 -25
  181. data/lib/steep/errors.rb +0 -594
  182. data/lib/steep/signature/errors.rb +0 -128
  183. data/lib/steep/type_assignability.rb +0 -367
@@ -0,0 +1,49 @@
1
+ ---
2
+ test:
3
+ a.rb:
4
+ diagnostics:
5
+ - |
6
+ a.rb:6:4: [error] Cannot assign a value of type `::Integer` to a variable of type `::String`
7
+ │ ::Integer <: ::String
8
+ │ ::Numeric <: ::String
9
+ │ ::Object <: ::String
10
+ │ ::BasicObject <: ::String
11
+
12
+ │ Diagnostic ID: Ruby::IncompatibleAssignment
13
+
14
+ └ x = yield(3)
15
+ ~~~~~~~~~~~~
16
+ - |
17
+ a.rb:8:10: [error] Cannot assign a value of type `::String` to an expression of type `::Integer`
18
+ │ ::String <: ::Integer
19
+ │ ::Object <: ::Integer
20
+ │ ::BasicObject <: ::Integer
21
+
22
+ │ Diagnostic ID: Ruby::IncompatibleAssignment
23
+
24
+ └ yield(x)
25
+ ~
26
+ - |
27
+ a.rb:13:4: [error] No block given for `yield`
28
+ │ Diagnostic ID: Ruby::UnexpectedYield
29
+
30
+ └ yield 4
31
+ ~~~~~~~
32
+ - |
33
+ a.rb:13:4: [error] Cannot detect the type of the expression
34
+ │ Diagnostic ID: Ruby::FallbackAny
35
+
36
+ └ yield 4
37
+ ~~~~~~~
38
+ b.rb:
39
+ diagnostics:
40
+ - |
41
+ b.rb:4:10: [error] Cannot assign a value of type `::String` to an expression of type `::Integer`
42
+ │ ::String <: ::Integer
43
+ │ ::Object <: ::Integer
44
+ │ ::BasicObject <: ::Integer
45
+
46
+ │ Diagnostic ID: Ruby::IncompatibleAssignment
47
+
48
+ └ yield ""
49
+ ~~
@@ -28,11 +28,11 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.required_ruby_version = '>= 2.6.0'
30
30
 
31
- spec.add_runtime_dependency "parser", "~> 2.7.0"
32
- spec.add_runtime_dependency "ast_utils", "~> 0.3.0"
31
+ spec.add_runtime_dependency "parser", ">= 2.7"
32
+ spec.add_runtime_dependency "ast_utils", ">= 0.4.0"
33
33
  spec.add_runtime_dependency "activesupport", ">= 5.1"
34
34
  spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
35
35
  spec.add_runtime_dependency "listen", "~> 3.0"
36
36
  spec.add_runtime_dependency "language_server-protocol", "~> 3.15.0.1"
37
- spec.add_runtime_dependency "rbs", "~> 1.0.0"
37
+ spec.add_runtime_dependency "rbs", "~> 1.0.3"
38
38
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.0
4
+ version: 0.40.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-25 00:00:00.000000000 Z
11
+ date: 2021-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.7.0
19
+ version: '2.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 2.7.0
26
+ version: '2.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ast_utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.0
33
+ version: 0.4.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.0
40
+ version: 0.4.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -106,14 +106,14 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: 1.0.0
109
+ version: 1.0.3
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: 1.0.0
116
+ version: 1.0.3
117
117
  description: Gradual Typing for Ruby
118
118
  email:
119
119
  - matsumoto@soutaro.com
@@ -132,8 +132,9 @@ files:
132
132
  - Rakefile
133
133
  - Steepfile
134
134
  - bin/console
135
+ - bin/output_rebaseline.rb
136
+ - bin/output_test.rb
135
137
  - bin/setup
136
- - bin/smoke_runner.rb
137
138
  - bin/steep-prof
138
139
  - exe/steep
139
140
  - lib/steep.rb
@@ -164,12 +165,16 @@ files:
164
165
  - lib/steep/ast/types/var.rb
165
166
  - lib/steep/ast/types/void.rb
166
167
  - lib/steep/cli.rb
168
+ - lib/steep/diagnostic/helper.rb
169
+ - lib/steep/diagnostic/lsp_formatter.rb
170
+ - lib/steep/diagnostic/ruby.rb
171
+ - lib/steep/diagnostic/signature.rb
167
172
  - lib/steep/drivers/annotations.rb
168
173
  - lib/steep/drivers/check.rb
174
+ - lib/steep/drivers/diagnostic_printer.rb
169
175
  - lib/steep/drivers/init.rb
170
176
  - lib/steep/drivers/langserver.rb
171
177
  - lib/steep/drivers/print_project.rb
172
- - lib/steep/drivers/signature_error_printer.rb
173
178
  - lib/steep/drivers/stats.rb
174
179
  - lib/steep/drivers/trace_printer.rb
175
180
  - lib/steep/drivers/utils/driver_helper.rb
@@ -177,7 +182,6 @@ files:
177
182
  - lib/steep/drivers/vendor.rb
178
183
  - lib/steep/drivers/watch.rb
179
184
  - lib/steep/drivers/worker.rb
180
- - lib/steep/errors.rb
181
185
  - lib/steep/index/rbs_index.rb
182
186
  - lib/steep/index/signature_symbol_provider.rb
183
187
  - lib/steep/index/source_index.rb
@@ -197,7 +201,9 @@ files:
197
201
  - lib/steep/project/options.rb
198
202
  - lib/steep/project/signature_file.rb
199
203
  - lib/steep/project/source_file.rb
204
+ - lib/steep/project/stats_calculator.rb
200
205
  - lib/steep/project/target.rb
206
+ - lib/steep/range_extension.rb
201
207
  - lib/steep/server/base_worker.rb
202
208
  - lib/steep/server/code_worker.rb
203
209
  - lib/steep/server/interaction_worker.rb
@@ -205,7 +211,6 @@ files:
205
211
  - lib/steep/server/signature_worker.rb
206
212
  - lib/steep/server/utils.rb
207
213
  - lib/steep/server/worker_process.rb
208
- - lib/steep/signature/errors.rb
209
214
  - lib/steep/signature/validator.rb
210
215
  - lib/steep/source.rb
211
216
  - lib/steep/subtyping/check.rb
@@ -215,7 +220,6 @@ files:
215
220
  - lib/steep/subtyping/trace.rb
216
221
  - lib/steep/subtyping/variable_occurrence.rb
217
222
  - lib/steep/subtyping/variable_variance.rb
218
- - lib/steep/type_assignability.rb
219
223
  - lib/steep/type_construction.rb
220
224
  - lib/steep/type_inference/block_params.rb
221
225
  - lib/steep/type_inference/constant_env.rb
@@ -239,12 +243,15 @@ files:
239
243
  - smoke/alias/a.rbs
240
244
  - smoke/alias/b.rb
241
245
  - smoke/alias/c.rb
246
+ - smoke/alias/test.yaml
242
247
  - smoke/and/Steepfile
243
248
  - smoke/and/a.rb
249
+ - smoke/and/test.yaml
244
250
  - smoke/array/Steepfile
245
251
  - smoke/array/a.rb
246
252
  - smoke/array/b.rb
247
253
  - smoke/array/c.rb
254
+ - smoke/array/test.yaml
248
255
  - smoke/block/Steepfile
249
256
  - smoke/block/a.rb
250
257
  - smoke/block/a.rbs
@@ -252,8 +259,14 @@ files:
252
259
  - smoke/block/c.rb
253
260
  - smoke/block/c.rbs
254
261
  - smoke/block/d.rb
262
+ - smoke/block/test.yaml
263
+ - smoke/broken/Steepfile
264
+ - smoke/broken/broken.rb
265
+ - smoke/broken/broken.rbs
266
+ - smoke/broken/test.yaml
255
267
  - smoke/case/Steepfile
256
268
  - smoke/case/a.rb
269
+ - smoke/case/test.yaml
257
270
  - smoke/class/Steepfile
258
271
  - smoke/class/a.rb
259
272
  - smoke/class/a.rbs
@@ -265,15 +278,67 @@ files:
265
278
  - smoke/class/h.rbs
266
279
  - smoke/class/i.rb
267
280
  - smoke/class/i.rbs
281
+ - smoke/class/test.yaml
268
282
  - smoke/const/Steepfile
269
283
  - smoke/const/a.rb
284
+ - smoke/const/b.rb
285
+ - smoke/const/b.rbs
286
+ - smoke/const/test.yaml
287
+ - smoke/diagnostics-rbs-duplicated/Steepfile
288
+ - smoke/diagnostics-rbs-duplicated/a.rbs
289
+ - smoke/diagnostics-rbs-duplicated/test.yaml
290
+ - smoke/diagnostics-rbs/Steepfile
291
+ - smoke/diagnostics-rbs/duplicated-method-definition.rbs
292
+ - smoke/diagnostics-rbs/generic-parameter-mismatch.rbs
293
+ - smoke/diagnostics-rbs/invalid-method-overload.rbs
294
+ - smoke/diagnostics-rbs/invalid-type-application.rbs
295
+ - smoke/diagnostics-rbs/invalid_variance_annotation.rbs
296
+ - smoke/diagnostics-rbs/recursive-alias.rbs
297
+ - smoke/diagnostics-rbs/recursive-class.rbs
298
+ - smoke/diagnostics-rbs/superclass-mismatch.rbs
299
+ - smoke/diagnostics-rbs/test.yaml
300
+ - smoke/diagnostics-rbs/unknown-method-alias.rbs
301
+ - smoke/diagnostics-rbs/unknown-type-name.rbs
302
+ - smoke/diagnostics/Steepfile
303
+ - smoke/diagnostics/a.rbs
304
+ - smoke/diagnostics/argument_type_mismatch.rb
305
+ - smoke/diagnostics/block_body_type_mismatch.rb
306
+ - smoke/diagnostics/block_type_mismatch.rb
307
+ - smoke/diagnostics/break_type_mismatch.rb
308
+ - smoke/diagnostics/else_on_exhaustive_case.rb
309
+ - smoke/diagnostics/incompatible_annotation.rb
310
+ - smoke/diagnostics/incompatible_argument.rb
311
+ - smoke/diagnostics/incompatible_assignment.rb
312
+ - smoke/diagnostics/method_arity_mismatch.rb
313
+ - smoke/diagnostics/method_body_type_mismatch.rb
314
+ - smoke/diagnostics/method_definition_missing.rb
315
+ - smoke/diagnostics/method_return_type_annotation_mismatch.rb
316
+ - smoke/diagnostics/missing_keyword.rb
317
+ - smoke/diagnostics/no_method.rb
318
+ - smoke/diagnostics/required_block_missing.rb
319
+ - smoke/diagnostics/return_type_mismatch.rb
320
+ - smoke/diagnostics/test.yaml
321
+ - smoke/diagnostics/unexpected_block_given.rb
322
+ - smoke/diagnostics/unexpected_dynamic_method.rb
323
+ - smoke/diagnostics/unexpected_jump.rb
324
+ - smoke/diagnostics/unexpected_jump_value.rb
325
+ - smoke/diagnostics/unexpected_keyword.rb
326
+ - smoke/diagnostics/unexpected_splat.rb
327
+ - smoke/diagnostics/unexpected_yield.rb
328
+ - smoke/diagnostics/unknown_constant_assigned.rb
329
+ - smoke/diagnostics/unresolved_overloading.rb
330
+ - smoke/diagnostics/unsatisfiable_constraint.rb
331
+ - smoke/diagnostics/unsupported_syntax.rb
270
332
  - smoke/dstr/Steepfile
271
333
  - smoke/dstr/a.rb
334
+ - smoke/dstr/test.yaml
272
335
  - smoke/ensure/Steepfile
273
336
  - smoke/ensure/a.rb
337
+ - smoke/ensure/test.yaml
274
338
  - smoke/enumerator/Steepfile
275
339
  - smoke/enumerator/a.rb
276
340
  - smoke/enumerator/b.rb
341
+ - smoke/enumerator/test.yaml
277
342
  - smoke/extension/Steepfile
278
343
  - smoke/extension/a.rb
279
344
  - smoke/extension/a.rbs
@@ -282,6 +347,7 @@ files:
282
347
  - smoke/extension/d.rb
283
348
  - smoke/extension/e.rb
284
349
  - smoke/extension/e.rbs
350
+ - smoke/extension/test.yaml
285
351
  - smoke/hash/Steepfile
286
352
  - smoke/hash/a.rb
287
353
  - smoke/hash/a.rbs
@@ -291,32 +357,43 @@ files:
291
357
  - smoke/hash/e.rb
292
358
  - smoke/hash/e.rbs
293
359
  - smoke/hash/f.rb
360
+ - smoke/hash/test.yaml
294
361
  - smoke/hello/Steepfile
295
362
  - smoke/hello/hello.rb
296
363
  - smoke/hello/hello.rbs
364
+ - smoke/hello/test.yaml
297
365
  - smoke/if/Steepfile
298
366
  - smoke/if/a.rb
367
+ - smoke/if/test.yaml
299
368
  - smoke/implements/Steepfile
300
369
  - smoke/implements/a.rb
301
370
  - smoke/implements/a.rbs
371
+ - smoke/implements/test.yaml
302
372
  - smoke/initialize/Steepfile
303
373
  - smoke/initialize/a.rb
304
374
  - smoke/initialize/a.rbs
375
+ - smoke/initialize/test.yaml
305
376
  - smoke/integer/Steepfile
306
377
  - smoke/integer/a.rb
378
+ - smoke/integer/test.yaml
307
379
  - smoke/interface/Steepfile
308
380
  - smoke/interface/a.rb
309
381
  - smoke/interface/a.rbs
382
+ - smoke/interface/test.yaml
310
383
  - smoke/kwbegin/Steepfile
311
384
  - smoke/kwbegin/a.rb
385
+ - smoke/kwbegin/test.yaml
312
386
  - smoke/lambda/Steepfile
313
387
  - smoke/lambda/a.rb
388
+ - smoke/lambda/test.yaml
314
389
  - smoke/literal/Steepfile
315
390
  - smoke/literal/a.rb
316
391
  - smoke/literal/b.rb
317
392
  - smoke/literal/literal_methods.rbs
393
+ - smoke/literal/test.yaml
318
394
  - smoke/map/Steepfile
319
395
  - smoke/map/a.rb
396
+ - smoke/map/test.yaml
320
397
  - smoke/method/Steepfile
321
398
  - smoke/method/a.rb
322
399
  - smoke/method/a.rbs
@@ -324,6 +401,7 @@ files:
324
401
  - smoke/method/c.rb
325
402
  - smoke/method/d.rb
326
403
  - smoke/method/d.rbs
404
+ - smoke/method/test.yaml
327
405
  - smoke/module/Steepfile
328
406
  - smoke/module/a.rb
329
407
  - smoke/module/a.rbs
@@ -332,9 +410,11 @@ files:
332
410
  - smoke/module/d.rb
333
411
  - smoke/module/e.rb
334
412
  - smoke/module/f.rb
413
+ - smoke/module/test.yaml
335
414
  - smoke/regexp/Steepfile
336
415
  - smoke/regexp/a.rb
337
416
  - smoke/regexp/b.rb
417
+ - smoke/regexp/test.yaml
338
418
  - smoke/regression/Steepfile
339
419
  - smoke/regression/array.rb
340
420
  - smoke/regression/fun.rb
@@ -344,28 +424,39 @@ files:
344
424
  - smoke/regression/poly_new.rbs
345
425
  - smoke/regression/range.rb
346
426
  - smoke/regression/set_divide.rb
427
+ - smoke/regression/test.yaml
347
428
  - smoke/rescue/Steepfile
348
429
  - smoke/rescue/a.rb
430
+ - smoke/rescue/test.yaml
349
431
  - smoke/self/Steepfile
350
432
  - smoke/self/a.rb
351
433
  - smoke/self/a.rbs
434
+ - smoke/self/test.yaml
352
435
  - smoke/skip/Steepfile
353
436
  - smoke/skip/skip.rb
437
+ - smoke/skip/test.yaml
354
438
  - smoke/stdout/Steepfile
355
439
  - smoke/stdout/a.rb
356
440
  - smoke/stdout/a.rbs
441
+ - smoke/stdout/test.yaml
357
442
  - smoke/super/Steepfile
358
443
  - smoke/super/a.rb
359
444
  - smoke/super/a.rbs
445
+ - smoke/super/test.yaml
360
446
  - smoke/toplevel/Steepfile
361
447
  - smoke/toplevel/a.rb
362
448
  - smoke/toplevel/a.rbs
449
+ - smoke/toplevel/test.yaml
363
450
  - smoke/tsort/Steepfile
364
451
  - smoke/tsort/a.rb
452
+ - smoke/tsort/test.yaml
365
453
  - smoke/type_case/Steepfile
366
454
  - smoke/type_case/a.rb
455
+ - smoke/type_case/test.yaml
367
456
  - smoke/yield/Steepfile
368
457
  - smoke/yield/a.rb
458
+ - smoke/yield/b.rb
459
+ - smoke/yield/test.yaml
369
460
  - steep.gemspec
370
461
  homepage: https://github.com/soutaro/steep
371
462
  licenses:
@@ -1,139 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "pathname"
4
-
5
- $LOAD_PATH << Pathname(__dir__) + "../lib"
6
-
7
- require "steep"
8
- require "steep/cli"
9
- require "rainbow"
10
- require "optparse"
11
-
12
- verbose = false
13
-
14
- OptionParser.new do |opts|
15
- opts.on("-v", "--verbose") do verbose = true end
16
- end.parse!(ARGV)
17
-
18
- Expectation = Struct.new(:line, :message, :path, :starts) do
19
- attr_accessor :prefix_test
20
- end
21
-
22
- failed = false
23
-
24
- ARGV.each do |arg|
25
- dir = Pathname(arg)
26
- puts "🏇 Running smoke test in #{dir}..."
27
-
28
- rb_files = []
29
- expectations = []
30
- allowed_paths = []
31
-
32
- dir.children.each do |file|
33
- if file.extname == ".rb"
34
- buffer = ::Parser::Source::Buffer.new(file.to_s)
35
- buffer.source = file.read
36
- parser = ::Parser::Ruby27.new
37
-
38
- _, comments, _ = parser.tokenize(buffer)
39
- comments.each do |comment|
40
- src = comment.text.gsub(/\A#\s*/, '')
41
-
42
- if src =~ /!expects\*(@(\+\d+))?/
43
- offset = $2&.to_i || 1
44
- message = src.gsub!(/\A!expects\*(@\+\d+)? +/, '')
45
- line = comment.location.line
46
-
47
- expectations << Expectation.new(line+offset, message, file.relative_path_from(dir)).tap {|e| e.prefix_test = true }
48
- end
49
-
50
- if src =~ /!expects(@(\+\d+))?/
51
- offset = $2&.to_i || 1
52
- message = src.gsub!(/\A!expects(@\+\d+)? +/, '')
53
- line = comment.location.line
54
-
55
- expectations << Expectation.new(line+offset, message, file.relative_path_from(dir))
56
- end
57
-
58
- if src =~ /ALLOW FAILURE/
59
- allowed_paths << file.relative_path_from(dir)
60
- end
61
- end
62
-
63
- rb_files << file
64
- end
65
- end
66
-
67
- stderr = StringIO.new
68
- stdout = StringIO.new
69
-
70
- begin
71
- Rainbow.enabled = false
72
- Dir.chdir(arg) do
73
- Steep::Drivers::Check.new(stdout: stdout, stderr: stderr).run
74
- end
75
- rescue => exn
76
- puts "ERROR: #{exn.inspect}"
77
- exn.backtrace.each do |loc|
78
- puts " #{loc}"
79
- end
80
-
81
- failed = true
82
- ensure
83
- Rainbow.enabled = true
84
- end
85
-
86
- if verbose
87
- stdout.string.each_line do |line|
88
- puts "stdout> #{line.chomp}"
89
- end
90
-
91
- stderr.string.each_line do |line|
92
- puts "stderr> #{line.chomp}"
93
- end
94
- end
95
-
96
- lines = stdout.string.each_line.to_a.map(&:chomp).reject {|line| line =~ /\bFallbackAny\b/ }
97
-
98
- expectations.each do |expectation|
99
- deleted = lines.reject! do |string|
100
- if expectation.prefix_test
101
- string =~ /\A#{Regexp.escape(expectation.path.to_s)}:#{expectation.line}:\d+: #{Regexp.quote expectation.message}/
102
- else
103
- string =~ /\A#{Regexp.escape(expectation.path.to_s)}:#{expectation.line}:\d+: #{Regexp.quote expectation.message} \(/
104
- end
105
- end
106
-
107
- unless deleted
108
- allowed = allowed_paths.any? {|path| path == expectation.path }
109
- message = Rainbow(" 💀 Expected error not found: #{expectation.path}:#{expectation.line}:#{expectation.message}")
110
- if allowed
111
- puts message.yellow
112
- else
113
- puts message.red
114
- failed = true
115
- end
116
- end
117
- end
118
-
119
- unless lines.empty?
120
- lines.each do |line|
121
- if line =~ /\A([^:]+):\d+:\d+:/
122
- message = Rainbow(" 🤦‍♀️ Unexpected error found: #{line}")
123
-
124
- if allowed_paths.include?(Pathname($1))
125
- puts message.yellow
126
- else
127
- puts message.red
128
- failed = true
129
- end
130
- end
131
- end
132
- end
133
- end
134
-
135
- if failed
136
- exit(1)
137
- else
138
- puts Rainbow("All smoke test pass 😆").blue
139
- end