steep 0.43.0 → 0.45.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +8 -0
  3. data/.github/workflows/ruby.yml +3 -2
  4. data/.gitignore +0 -1
  5. data/CHANGELOG.md +30 -0
  6. data/Gemfile +0 -1
  7. data/Gemfile.lock +77 -0
  8. data/bin/output_test.rb +8 -2
  9. data/lib/steep.rb +4 -1
  10. data/lib/steep/ast/builtin.rb +7 -1
  11. data/lib/steep/ast/types/factory.rb +19 -25
  12. data/lib/steep/diagnostic/ruby.rb +137 -60
  13. data/lib/steep/diagnostic/signature.rb +34 -0
  14. data/lib/steep/equatable.rb +21 -0
  15. data/lib/steep/index/source_index.rb +55 -5
  16. data/lib/steep/interface/block.rb +4 -0
  17. data/lib/steep/interface/function.rb +798 -579
  18. data/lib/steep/server/interaction_worker.rb +239 -20
  19. data/lib/steep/server/master.rb +40 -19
  20. data/lib/steep/server/type_check_worker.rb +68 -0
  21. data/lib/steep/services/file_loader.rb +26 -19
  22. data/lib/steep/services/goto_service.rb +322 -0
  23. data/lib/steep/services/hover_content.rb +131 -79
  24. data/lib/steep/services/type_check_service.rb +25 -0
  25. data/lib/steep/source.rb +7 -10
  26. data/lib/steep/type_construction.rb +496 -518
  27. data/lib/steep/type_inference/block_params.rb +2 -5
  28. data/lib/steep/type_inference/method_params.rb +483 -0
  29. data/lib/steep/type_inference/send_args.rb +610 -128
  30. data/lib/steep/typing.rb +46 -21
  31. data/lib/steep/version.rb +1 -1
  32. data/sig/steep/type_inference/send_args.rbs +42 -0
  33. data/smoke/array/test_expectations.yml +3 -3
  34. data/smoke/block/c.rb +0 -1
  35. data/smoke/class/test_expectations.yml +12 -15
  36. data/smoke/const/test_expectations.yml +0 -10
  37. data/smoke/diagnostics-rbs/mixin-class-error.rbs +6 -0
  38. data/smoke/diagnostics-rbs/test_expectations.yml +12 -0
  39. data/smoke/diagnostics-ruby-unsat/Steepfile +5 -0
  40. data/smoke/diagnostics-ruby-unsat/a.rbs +3 -0
  41. data/smoke/diagnostics-ruby-unsat/test_expectations.yml +27 -0
  42. data/smoke/{diagnostics → diagnostics-ruby-unsat}/unsatisfiable_constraint.rb +0 -1
  43. data/smoke/diagnostics/a.rbs +0 -4
  44. data/smoke/diagnostics/different_method_parameter_kind.rb +9 -0
  45. data/smoke/diagnostics/method_arity_mismatch.rb +2 -2
  46. data/smoke/diagnostics/method_parameter_mismatch.rb +10 -0
  47. data/smoke/diagnostics/test_expectations.yml +108 -57
  48. data/smoke/ensure/test_expectations.yml +3 -3
  49. data/smoke/enumerator/test_expectations.yml +1 -1
  50. data/smoke/literal/test_expectations.yml +2 -2
  51. data/smoke/method/test_expectations.yml +11 -10
  52. data/smoke/regression/issue_372.rb +8 -0
  53. data/smoke/regression/issue_372.rbs +4 -0
  54. data/smoke/regression/test_expectations.yml +0 -12
  55. data/smoke/rescue/test_expectations.yml +3 -3
  56. data/smoke/toplevel/test_expectations.yml +3 -3
  57. data/smoke/tsort/test_expectations.yml +2 -2
  58. data/steep.gemspec +2 -2
  59. metadata +24 -10
@@ -32,10 +32,10 @@
32
32
  - range:
33
33
  start:
34
34
  line: 13
35
- character: 0
35
+ character: 4
36
36
  end:
37
- line: 18
38
- character: 3
37
+ line: 13
38
+ character: 7
39
39
  severity: ERROR
40
40
  message: |-
41
41
  Cannot allow method body have type `::Integer` because declared as type `::String`
@@ -102,7 +102,7 @@
102
102
  Cannot find compatible overloading of method `with_object` of type `::Enumerator[::Integer, ::Array[::Integer]]`
103
103
  Method types:
104
104
  def with_object: [U] (U) { (::Integer, U) -> untyped } -> U
105
- | [U] (U) -> ::Enumerator[[::Integer, U], ::Array[::Integer]]
105
+ | [U] (U) -> ::Enumerator[[::Integer, U], U]
106
106
  code: Ruby::UnresolvedOverloading
107
107
  - range:
108
108
  start:
@@ -101,6 +101,6 @@
101
101
  character: 15
102
102
  severity: ERROR
103
103
  message: |-
104
- Cannot assign a value of type `::Symbol` to an expression of type `:foo`
104
+ Cannot pass a value of type `::Symbol` as an argument of type `:foo`
105
105
  ::Symbol <: :foo
106
- code: Ruby::IncompatibleAssignment
106
+ code: Ruby::ArgumentTypeMismatch
@@ -4,10 +4,10 @@
4
4
  - range:
5
5
  start:
6
6
  line: 3
7
- character: 0
7
+ character: 4
8
8
  end:
9
- line: 11
10
- character: 3
9
+ line: 3
10
+ character: 7
11
11
  severity: ERROR
12
12
  message: |-
13
13
  Cannot allow method body have type `::Integer` because declared as type `::String`
@@ -49,13 +49,14 @@
49
49
  - range:
50
50
  start:
51
51
  line: 15
52
- character: 7
52
+ character: 11
53
53
  end:
54
54
  line: 15
55
- character: 13
55
+ character: 12
56
56
  severity: ERROR
57
- message: Method parameters are incompatible with declaration `(::Integer) -> ::String`
58
- code: Ruby::MethodArityMismatch
57
+ message: The method parameter is incompatible with the declaration `(::Integer)
58
+ -> ::String`
59
+ code: Ruby::MethodParameterMismatch
59
60
  - range:
60
61
  start:
61
62
  line: 18
@@ -76,10 +77,10 @@
76
77
  - range:
77
78
  start:
78
79
  line: 4
79
- character: 2
80
+ character: 6
80
81
  end:
81
- line: 6
82
- character: 5
82
+ line: 4
83
+ character: 9
83
84
  severity: ERROR
84
85
  message: |-
85
86
  Cannot allow method body have type `::Symbol` because declared as type `(::Integer | ::String)`
@@ -0,0 +1,8 @@
1
+ class Issue372
2
+ def f(&block)
3
+ end
4
+
5
+ def g(&block)
6
+ f(&block)
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ class Issue372
2
+ def f: () ?{ () -> void } -> void
3
+ def g: () ?{ () -> void } -> void
4
+ end
@@ -58,15 +58,3 @@
58
58
  severity: ERROR
59
59
  message: Type `::String` does not have method `ggggg`
60
60
  code: Ruby::NoMethod
61
- - file: thread.rb
62
- diagnostics:
63
- - range:
64
- start:
65
- line: 6
66
- character: 13
67
- end:
68
- line: 7
69
- character: 3
70
- severity: ERROR
71
- message: The method cannot be called with a block
72
- code: Ruby::UnexpectedBlockGiven
@@ -64,10 +64,10 @@
64
64
  - range:
65
65
  start:
66
66
  line: 37
67
- character: 0
67
+ character: 4
68
68
  end:
69
- line: 41
70
- character: 3
69
+ line: 37
70
+ character: 7
71
71
  severity: ERROR
72
72
  message: |-
73
73
  Cannot allow method body have type `(::Integer | ::String)` because declared as type `::String`
@@ -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`
@@ -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:
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.0
4
+ version: 0.45.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-03-30 00:00:00.000000000 Z
11
+ date: 2021-08-22 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