steep 0.43.1 → 0.46.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +8 -0
  3. data/.github/workflows/ruby.yml +4 -2
  4. data/.gitignore +0 -1
  5. data/CHANGELOG.md +41 -0
  6. data/Gemfile +0 -1
  7. data/Gemfile.lock +77 -0
  8. data/bin/output_test.rb +8 -2
  9. data/lib/steep/ast/builtin.rb +7 -1
  10. data/lib/steep/ast/types/factory.rb +19 -25
  11. data/lib/steep/cli.rb +7 -1
  12. data/lib/steep/diagnostic/lsp_formatter.rb +59 -6
  13. data/lib/steep/diagnostic/ruby.rb +188 -60
  14. data/lib/steep/diagnostic/signature.rb +34 -0
  15. data/lib/steep/drivers/check.rb +3 -0
  16. data/lib/steep/drivers/init.rb +10 -3
  17. data/lib/steep/drivers/utils/driver_helper.rb +15 -0
  18. data/lib/steep/drivers/validate.rb +1 -1
  19. data/lib/steep/drivers/watch.rb +3 -0
  20. data/lib/steep/equatable.rb +21 -0
  21. data/lib/steep/index/source_index.rb +55 -5
  22. data/lib/steep/interface/block.rb +4 -0
  23. data/lib/steep/interface/function.rb +798 -579
  24. data/lib/steep/project/dsl.rb +105 -33
  25. data/lib/steep/project/options.rb +12 -53
  26. data/lib/steep/project/target.rb +21 -8
  27. data/lib/steep/server/interaction_worker.rb +239 -20
  28. data/lib/steep/server/master.rb +22 -1
  29. data/lib/steep/server/type_check_worker.rb +74 -9
  30. data/lib/steep/services/file_loader.rb +26 -19
  31. data/lib/steep/services/goto_service.rb +322 -0
  32. data/lib/steep/services/hover_content.rb +132 -80
  33. data/lib/steep/services/type_check_service.rb +25 -0
  34. data/lib/steep/source.rb +7 -10
  35. data/lib/steep/type_construction.rb +496 -518
  36. data/lib/steep/type_inference/block_params.rb +2 -5
  37. data/lib/steep/type_inference/method_params.rb +483 -0
  38. data/lib/steep/type_inference/send_args.rb +610 -128
  39. data/lib/steep/typing.rb +46 -21
  40. data/lib/steep/version.rb +1 -1
  41. data/lib/steep.rb +4 -1
  42. data/sample/Steepfile +10 -3
  43. data/sig/steep/type_inference/send_args.rbs +42 -0
  44. data/smoke/alias/Steepfile +2 -1
  45. data/smoke/and/Steepfile +2 -1
  46. data/smoke/array/Steepfile +2 -1
  47. data/smoke/array/test_expectations.yml +3 -3
  48. data/smoke/block/Steepfile +2 -2
  49. data/smoke/block/c.rb +0 -1
  50. data/smoke/case/Steepfile +2 -1
  51. data/smoke/class/Steepfile +2 -1
  52. data/smoke/class/test_expectations.yml +12 -15
  53. data/smoke/const/Steepfile +2 -1
  54. data/smoke/const/test_expectations.yml +0 -10
  55. data/smoke/diagnostics/Steepfile +2 -1
  56. data/smoke/diagnostics/a.rbs +0 -4
  57. data/smoke/diagnostics/different_method_parameter_kind.rb +9 -0
  58. data/smoke/diagnostics/method_arity_mismatch.rb +2 -2
  59. data/smoke/diagnostics/method_parameter_mismatch.rb +10 -0
  60. data/smoke/diagnostics/test_expectations.yml +108 -57
  61. data/smoke/diagnostics-rbs/Steepfile +1 -1
  62. data/smoke/diagnostics-rbs/mixin-class-error.rbs +6 -0
  63. data/smoke/diagnostics-rbs/test_expectations.yml +12 -0
  64. data/smoke/diagnostics-rbs-duplicated/Steepfile +2 -1
  65. data/smoke/diagnostics-ruby-unsat/Steepfile +6 -0
  66. data/smoke/diagnostics-ruby-unsat/a.rbs +3 -0
  67. data/smoke/diagnostics-ruby-unsat/test_expectations.yml +27 -0
  68. data/smoke/{diagnostics → diagnostics-ruby-unsat}/unsatisfiable_constraint.rb +0 -1
  69. data/smoke/dstr/Steepfile +2 -1
  70. data/smoke/ensure/Steepfile +2 -1
  71. data/smoke/ensure/test_expectations.yml +3 -3
  72. data/smoke/enumerator/Steepfile +2 -1
  73. data/smoke/enumerator/test_expectations.yml +1 -1
  74. data/smoke/extension/Steepfile +2 -1
  75. data/smoke/hash/Steepfile +2 -1
  76. data/smoke/hello/Steepfile +2 -1
  77. data/smoke/if/Steepfile +2 -1
  78. data/smoke/implements/Steepfile +2 -1
  79. data/smoke/initialize/Steepfile +2 -1
  80. data/smoke/integer/Steepfile +2 -1
  81. data/smoke/interface/Steepfile +2 -1
  82. data/smoke/kwbegin/Steepfile +2 -1
  83. data/smoke/lambda/Steepfile +2 -1
  84. data/smoke/literal/Steepfile +2 -1
  85. data/smoke/literal/test_expectations.yml +2 -2
  86. data/smoke/map/Steepfile +2 -1
  87. data/smoke/method/Steepfile +2 -1
  88. data/smoke/method/test_expectations.yml +11 -10
  89. data/smoke/module/Steepfile +2 -1
  90. data/smoke/regexp/Steepfile +2 -1
  91. data/smoke/regression/Steepfile +2 -1
  92. data/smoke/regression/issue_372.rb +8 -0
  93. data/smoke/regression/issue_372.rbs +4 -0
  94. data/smoke/regression/test_expectations.yml +0 -12
  95. data/smoke/rescue/Steepfile +2 -1
  96. data/smoke/rescue/test_expectations.yml +3 -3
  97. data/smoke/self/Steepfile +2 -1
  98. data/smoke/skip/Steepfile +2 -1
  99. data/smoke/stdout/Steepfile +2 -1
  100. data/smoke/super/Steepfile +2 -1
  101. data/smoke/toplevel/Steepfile +2 -1
  102. data/smoke/toplevel/test_expectations.yml +3 -3
  103. data/smoke/tsort/Steepfile +4 -5
  104. data/smoke/tsort/test_expectations.yml +2 -2
  105. data/smoke/type_case/Steepfile +2 -1
  106. data/smoke/unexpected/Steepfile +2 -1
  107. data/smoke/yield/Steepfile +2 -1
  108. data/steep.gemspec +2 -2
  109. metadata +24 -10
@@ -1,5 +1,6 @@
1
1
  target :test do
2
- typing_options :strict
3
2
  check "*.rb"
4
3
  signature "*.rbs"
4
+
5
+ configure_code_diagnostics(Steep::Diagnostic::Ruby.all_error)
5
6
  end
@@ -4,10 +4,10 @@
4
4
  - range:
5
5
  start:
6
6
  line: 1
7
- character: 0
7
+ character: 4
8
8
  end:
9
- line: 3
10
- character: 3
9
+ line: 1
10
+ character: 13
11
11
  severity: ERROR
12
12
  message: |-
13
13
  Cannot allow method body have type `nil` because declared as type `::String`
@@ -1,8 +1,7 @@
1
1
  target :test do
2
- signature "."
3
- check "."
4
-
5
- typing_options :strict
6
-
2
+ check "*.rb"
3
+ signature "*.rbs"
7
4
  library "tsort"
5
+
6
+ configure_code_diagnostics(Steep::Diagnostic::Ruby.all_error)
8
7
  end
@@ -32,8 +32,8 @@
32
32
  character: 41
33
33
  severity: ERROR
34
34
  message: |-
35
- Cannot assign a value of type `^(::Integer) -> ::Array[::Integer]` to a variable of type `^(::Integer) { (::Integer) -> void } -> void`
36
- ^(::Integer) -> ::Array[::Integer] <: ^(::Integer) { (::Integer) -> void } -> void
35
+ Cannot assign a value of type `^(::Integer) -> ::Enumerator[::Integer, ::Array[::Integer]]` to a variable of type `^(::Integer) { (::Integer) -> void } -> void`
36
+ ^(::Integer) -> ::Enumerator[::Integer, ::Array[::Integer]] <: ^(::Integer) { (::Integer) -> void } -> void
37
37
  code: Ruby::IncompatibleAssignment
38
38
  - range:
39
39
  start:
@@ -1,5 +1,6 @@
1
1
  target :test do
2
- typing_options :strict
3
2
  check "*.rb"
4
3
  signature "*.rbs"
4
+
5
+ configure_code_diagnostics(Steep::Diagnostic::Ruby.all_error)
5
6
  end
@@ -1,5 +1,6 @@
1
1
  target :test do
2
- typing_options :strict
3
2
  check "*.rb"
4
3
  signature "*.rbs"
4
+
5
+ configure_code_diagnostics(Steep::Diagnostic::Ruby.all_error)
5
6
  end
@@ -1,5 +1,6 @@
1
1
  target :test do
2
- typing_options :strict
3
2
  check "*.rb"
4
3
  signature "*.rbs"
4
+
5
+ configure_code_diagnostics(Steep::Diagnostic::Ruby.all_error)
5
6
  end
data/steep.gemspec CHANGED
@@ -28,12 +28,12 @@ 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"
31
+ spec.add_runtime_dependency "parser", ">= 3.0"
32
32
  spec.add_runtime_dependency "activesupport", ">= 5.1"
33
33
  spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
34
34
  spec.add_runtime_dependency "listen", "~> 3.0"
35
35
  spec.add_runtime_dependency "language_server-protocol", ">= 3.15", "< 4.0"
36
- spec.add_runtime_dependency "rbs", "~> 1.1.0"
36
+ spec.add_runtime_dependency "rbs", ">= 1.2.0"
37
37
  spec.add_runtime_dependency "parallel", ">= 1.0.0"
38
38
  spec.add_runtime_dependency "terminal-table", ">= 2", "< 4"
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.43.1
4
+ version: 0.46.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: 2021-04-01 00:00:00.000000000 Z
11
+ date: 2021-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.7'
19
+ version: '3.0'
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'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -96,16 +96,16 @@ dependencies:
96
96
  name: rbs
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - "~>"
99
+ - - ">="
100
100
  - !ruby/object:Gem::Version
101
- version: 1.1.0
101
+ version: 1.2.0
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - "~>"
106
+ - - ">="
107
107
  - !ruby/object:Gem::Version
108
- version: 1.1.0
108
+ version: 1.2.0
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: parallel
111
111
  requirement: !ruby/object:Gem::Requirement
@@ -148,11 +148,13 @@ executables:
148
148
  extensions: []
149
149
  extra_rdoc_files: []
150
150
  files:
151
+ - ".github/dependabot.yml"
151
152
  - ".github/workflows/ruby.yml"
152
153
  - ".gitignore"
153
154
  - ".gitmodules"
154
155
  - CHANGELOG.md
155
156
  - Gemfile
157
+ - Gemfile.lock
156
158
  - LICENSE
157
159
  - README.md
158
160
  - Rakefile
@@ -209,6 +211,7 @@ files:
209
211
  - lib/steep/drivers/vendor.rb
210
212
  - lib/steep/drivers/watch.rb
211
213
  - lib/steep/drivers/worker.rb
214
+ - lib/steep/equatable.rb
212
215
  - lib/steep/expectations.rb
213
216
  - lib/steep/index/rbs_index.rb
214
217
  - lib/steep/index/signature_symbol_provider.rb
@@ -236,6 +239,7 @@ files:
236
239
  - lib/steep/services/completion_provider.rb
237
240
  - lib/steep/services/content_change.rb
238
241
  - lib/steep/services/file_loader.rb
242
+ - lib/steep/services/goto_service.rb
239
243
  - lib/steep/services/hover_content.rb
240
244
  - lib/steep/services/path_assignment.rb
241
245
  - lib/steep/services/signature_service.rb
@@ -259,6 +263,7 @@ files:
259
263
  - lib/steep/type_inference/logic.rb
260
264
  - lib/steep/type_inference/logic_type_interpreter.rb
261
265
  - lib/steep/type_inference/method_call.rb
266
+ - lib/steep/type_inference/method_params.rb
262
267
  - lib/steep/type_inference/send_args.rb
263
268
  - lib/steep/type_inference/type_env.rb
264
269
  - lib/steep/typing.rb
@@ -268,6 +273,7 @@ files:
268
273
  - sample/lib/conference.rb
269
274
  - sample/sig/conference.rbs
270
275
  - sig/project.rbi
276
+ - sig/steep/type_inference/send_args.rbs
271
277
  - smoke/alias/Steepfile
272
278
  - smoke/alias/a.rb
273
279
  - smoke/alias/a.rbs
@@ -319,6 +325,7 @@ files:
319
325
  - smoke/diagnostics-rbs/invalid-method-overload.rbs
320
326
  - smoke/diagnostics-rbs/invalid-type-application.rbs
321
327
  - smoke/diagnostics-rbs/invalid_variance_annotation.rbs
328
+ - smoke/diagnostics-rbs/mixin-class-error.rbs
322
329
  - smoke/diagnostics-rbs/recursive-alias.rbs
323
330
  - smoke/diagnostics-rbs/recursive-class.rbs
324
331
  - smoke/diagnostics-rbs/superclass-mismatch.rbs
@@ -326,12 +333,17 @@ files:
326
333
  - smoke/diagnostics-rbs/unknown-method-alias.rbs
327
334
  - smoke/diagnostics-rbs/unknown-type-name-2.rbs
328
335
  - smoke/diagnostics-rbs/unknown-type-name.rbs
336
+ - smoke/diagnostics-ruby-unsat/Steepfile
337
+ - smoke/diagnostics-ruby-unsat/a.rbs
338
+ - smoke/diagnostics-ruby-unsat/test_expectations.yml
339
+ - smoke/diagnostics-ruby-unsat/unsatisfiable_constraint.rb
329
340
  - smoke/diagnostics/Steepfile
330
341
  - smoke/diagnostics/a.rbs
331
342
  - smoke/diagnostics/argument_type_mismatch.rb
332
343
  - smoke/diagnostics/block_body_type_mismatch.rb
333
344
  - smoke/diagnostics/block_type_mismatch.rb
334
345
  - smoke/diagnostics/break_type_mismatch.rb
346
+ - smoke/diagnostics/different_method_parameter_kind.rb
335
347
  - smoke/diagnostics/else_on_exhaustive_case.rb
336
348
  - smoke/diagnostics/incompatible_annotation.rb
337
349
  - smoke/diagnostics/incompatible_argument.rb
@@ -339,6 +351,7 @@ files:
339
351
  - smoke/diagnostics/method_arity_mismatch.rb
340
352
  - smoke/diagnostics/method_body_type_mismatch.rb
341
353
  - smoke/diagnostics/method_definition_missing.rb
354
+ - smoke/diagnostics/method_parameter_mismatch.rb
342
355
  - smoke/diagnostics/method_return_type_annotation_mismatch.rb
343
356
  - smoke/diagnostics/missing_keyword.rb
344
357
  - smoke/diagnostics/no_method.rb
@@ -354,7 +367,6 @@ files:
354
367
  - smoke/diagnostics/unexpected_yield.rb
355
368
  - smoke/diagnostics/unknown_constant_assigned.rb
356
369
  - smoke/diagnostics/unresolved_overloading.rb
357
- - smoke/diagnostics/unsatisfiable_constraint.rb
358
370
  - smoke/diagnostics/unsupported_syntax.rb
359
371
  - smoke/dstr/Steepfile
360
372
  - smoke/dstr/a.rb
@@ -455,6 +467,8 @@ files:
455
467
  - smoke/regression/issue_328.rbs
456
468
  - smoke/regression/issue_332.rb
457
469
  - smoke/regression/issue_332.rbs
470
+ - smoke/regression/issue_372.rb
471
+ - smoke/regression/issue_372.rbs
458
472
  - smoke/regression/masgn.rb
459
473
  - smoke/regression/poly_new.rb
460
474
  - smoke/regression/poly_new.rbs
@@ -521,7 +535,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
521
535
  - !ruby/object:Gem::Version
522
536
  version: '0'
523
537
  requirements: []
524
- rubygems_version: 3.2.3
538
+ rubygems_version: 3.2.22
525
539
  signing_key:
526
540
  specification_version: 4
527
541
  summary: Gradual Typing for Ruby