steep 0.40.0 → 0.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/bin/output_rebaseline.rb +15 -30
  4. data/bin/output_test.rb +17 -57
  5. data/lib/steep.rb +4 -0
  6. data/lib/steep/cli.rb +9 -3
  7. data/lib/steep/drivers/check.rb +106 -14
  8. data/lib/steep/drivers/diagnostic_printer.rb +11 -11
  9. data/lib/steep/expectations.rb +159 -0
  10. data/lib/steep/project.rb +6 -0
  11. data/lib/steep/version.rb +1 -1
  12. data/smoke/alias/test_expectations.yml +96 -0
  13. data/smoke/and/test_expectations.yml +31 -0
  14. data/smoke/array/test_expectations.yml +103 -0
  15. data/smoke/block/test_expectations.yml +125 -0
  16. data/smoke/case/test_expectations.yml +47 -0
  17. data/smoke/class/test_expectations.yml +120 -0
  18. data/smoke/const/test_expectations.yml +139 -0
  19. data/smoke/diagnostics-rbs-duplicated/test_expectations.yml +13 -0
  20. data/smoke/diagnostics-rbs/test_expectations.yml +229 -0
  21. data/smoke/diagnostics/test_expectations.yml +477 -0
  22. data/smoke/dstr/test_expectations.yml +13 -0
  23. data/smoke/ensure/test_expectations.yml +62 -0
  24. data/smoke/enumerator/test_expectations.yml +135 -0
  25. data/smoke/extension/test_expectations.yml +61 -0
  26. data/smoke/hash/test_expectations.yml +81 -0
  27. data/smoke/hello/test_expectations.yml +25 -0
  28. data/smoke/if/test_expectations.yml +34 -0
  29. data/smoke/implements/test_expectations.yml +23 -0
  30. data/smoke/initialize/test_expectations.yml +1 -0
  31. data/smoke/integer/test_expectations.yml +101 -0
  32. data/smoke/interface/test_expectations.yml +23 -0
  33. data/smoke/kwbegin/test_expectations.yml +17 -0
  34. data/smoke/lambda/test_expectations.yml +39 -0
  35. data/smoke/literal/test_expectations.yml +106 -0
  36. data/smoke/map/test_expectations.yml +1 -0
  37. data/smoke/method/test_expectations.yml +90 -0
  38. data/smoke/module/test_expectations.yml +75 -0
  39. data/smoke/regexp/test_expectations.yml +615 -0
  40. data/smoke/regression/test_expectations.yml +43 -0
  41. data/smoke/rescue/test_expectations.yml +79 -0
  42. data/smoke/self/test_expectations.yml +23 -0
  43. data/smoke/skip/test_expectations.yml +23 -0
  44. data/smoke/stdout/test_expectations.yml +1 -0
  45. data/smoke/super/test_expectations.yml +79 -0
  46. data/smoke/toplevel/test_expectations.yml +15 -0
  47. data/smoke/tsort/test_expectations.yml +43 -0
  48. data/smoke/type_case/test_expectations.yml +48 -0
  49. data/smoke/yield/test_expectations.yml +68 -0
  50. metadata +41 -44
  51. data/smoke/alias/test.yaml +0 -73
  52. data/smoke/and/test.yaml +0 -24
  53. data/smoke/array/test.yaml +0 -80
  54. data/smoke/block/test.yaml +0 -96
  55. data/smoke/broken/Steepfile +0 -5
  56. data/smoke/broken/broken.rb +0 -0
  57. data/smoke/broken/broken.rbs +0 -0
  58. data/smoke/broken/test.yaml +0 -6
  59. data/smoke/case/test.yaml +0 -36
  60. data/smoke/class/test.yaml +0 -89
  61. data/smoke/const/test.yaml +0 -96
  62. data/smoke/diagnostics-rbs-duplicated/test.yaml +0 -10
  63. data/smoke/diagnostics-rbs/test.yaml +0 -142
  64. data/smoke/diagnostics/test.yaml +0 -333
  65. data/smoke/dstr/test.yaml +0 -10
  66. data/smoke/ensure/test.yaml +0 -47
  67. data/smoke/enumerator/test.yaml +0 -100
  68. data/smoke/extension/test.yaml +0 -50
  69. data/smoke/hash/test.yaml +0 -62
  70. data/smoke/hello/test.yaml +0 -18
  71. data/smoke/if/test.yaml +0 -27
  72. data/smoke/implements/test.yaml +0 -16
  73. data/smoke/initialize/test.yaml +0 -4
  74. data/smoke/integer/test.yaml +0 -66
  75. data/smoke/interface/test.yaml +0 -16
  76. data/smoke/kwbegin/test.yaml +0 -14
  77. data/smoke/lambda/test.yaml +0 -28
  78. data/smoke/literal/test.yaml +0 -79
  79. data/smoke/map/test.yaml +0 -4
  80. data/smoke/method/test.yaml +0 -71
  81. data/smoke/module/test.yaml +0 -51
  82. data/smoke/regexp/test.yaml +0 -372
  83. data/smoke/regression/test.yaml +0 -38
  84. data/smoke/rescue/test.yaml +0 -60
  85. data/smoke/self/test.yaml +0 -16
  86. data/smoke/skip/test.yaml +0 -16
  87. data/smoke/stdout/test.yaml +0 -4
  88. data/smoke/super/test.yaml +0 -52
  89. data/smoke/toplevel/test.yaml +0 -12
  90. data/smoke/tsort/test.yaml +0 -32
  91. data/smoke/type_case/test.yaml +0 -33
  92. data/smoke/yield/test.yaml +0 -49
@@ -0,0 +1,47 @@
1
+ ---
2
+ - file: a.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 3
7
+ character: 0
8
+ end:
9
+ line: 13
10
+ character: 7
11
+ severity: ERROR
12
+ message: |-
13
+ Cannot assign a value of type `(::Integer | ::Array[::String] | nil | ::String)` to a variable of type `::Integer`
14
+ (::Integer | ::Array[::String] | nil | ::String) <: ::Integer
15
+ ::Array[::String] <: ::Integer
16
+ ::Object <: ::Integer
17
+ ::BasicObject <: ::Integer
18
+ code: Ruby::IncompatibleAssignment
19
+ - range:
20
+ start:
21
+ line: 15
22
+ character: 0
23
+ end:
24
+ line: 18
25
+ character: 7
26
+ severity: ERROR
27
+ message: |-
28
+ Cannot assign a value of type `(::Integer | nil)` to a variable of type `::Integer`
29
+ (::Integer | nil) <: ::Integer
30
+ nil <: ::Integer
31
+ code: Ruby::IncompatibleAssignment
32
+ - range:
33
+ start:
34
+ line: 16
35
+ character: 9
36
+ end:
37
+ line: 16
38
+ character: 14
39
+ severity: ERROR
40
+ message: |-
41
+ Cannot find compatible overloading of method `+` of type `::Integer`
42
+ Method types:
43
+ def +: (::Integer) -> ::Integer
44
+ | (::Float) -> ::Float
45
+ | (::Rational) -> ::Rational
46
+ | (::Complex) -> ::Complex
47
+ code: Ruby::UnresolvedOverloading
@@ -0,0 +1,120 @@
1
+ ---
2
+ - file: a.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 8
7
+ character: 9
8
+ end:
9
+ line: 8
10
+ character: 12
11
+ severity: ERROR
12
+ message: Method parameters are incompatible with declaration `() -> ::String`
13
+ code: Ruby::MethodArityMismatch
14
+ - range:
15
+ start:
16
+ line: 13
17
+ character: 2
18
+ end:
19
+ line: 15
20
+ character: 5
21
+ severity: ERROR
22
+ message: |-
23
+ Cannot allow method body have type `::Integer` because declared as type `::String`
24
+ ::Integer <: ::String
25
+ ::Numeric <: ::String
26
+ ::Object <: ::String
27
+ ::BasicObject <: ::String
28
+ code: Ruby::MethodBodyTypeMismatch
29
+ - range:
30
+ start:
31
+ line: 22
32
+ character: 2
33
+ end:
34
+ line: 24
35
+ character: 5
36
+ severity: ERROR
37
+ message: |-
38
+ Cannot allow method body have type `::String` because declared as type `::Integer`
39
+ ::String <: ::Integer
40
+ ::Object <: ::Integer
41
+ ::BasicObject <: ::Integer
42
+ code: Ruby::MethodBodyTypeMismatch
43
+ - file: c.rb
44
+ diagnostics:
45
+ - range:
46
+ start:
47
+ line: 1
48
+ character: 6
49
+ end:
50
+ line: 1
51
+ character: 7
52
+ severity: ERROR
53
+ message: "@dynamic annotation contains unknown method name `type`"
54
+ code: Ruby::UnexpectedDynamicMethod
55
+ - file: f.rb
56
+ diagnostics:
57
+ - range:
58
+ start:
59
+ line: 9
60
+ character: 0
61
+ end:
62
+ line: 9
63
+ character: 5
64
+ severity: ERROR
65
+ message: |-
66
+ Cannot assign a value of type `::_E` to a variable of type `::D`
67
+ ::_E <: ::D
68
+ code: Ruby::IncompatibleAssignment
69
+ - file: g.rb
70
+ diagnostics:
71
+ - range:
72
+ start:
73
+ line: 1
74
+ character: 6
75
+ end:
76
+ line: 1
77
+ character: 7
78
+ severity: ERROR
79
+ message: Cannot find implementation of method `::B#name`
80
+ code: Ruby::MethodDefinitionMissing
81
+ - range:
82
+ start:
83
+ line: 4
84
+ character: 6
85
+ end:
86
+ line: 4
87
+ character: 7
88
+ severity: ERROR
89
+ message: Cannot find implementation of method `::B#name`
90
+ code: Ruby::MethodDefinitionMissing
91
+ - file: i.rb
92
+ diagnostics:
93
+ - range:
94
+ start:
95
+ line: 4
96
+ character: 4
97
+ end:
98
+ line: 4
99
+ character: 15
100
+ severity: ERROR
101
+ message: |-
102
+ Cannot assign a value of type `::Integer` to a variable of type `::Symbol`
103
+ ::Integer <: ::Symbol
104
+ ::Numeric <: ::Symbol
105
+ ::Object <: ::Symbol
106
+ ::BasicObject <: ::Symbol
107
+ code: Ruby::IncompatibleAssignment
108
+ - range:
109
+ start:
110
+ line: 10
111
+ character: 4
112
+ end:
113
+ line: 10
114
+ character: 11
115
+ severity: ERROR
116
+ message: |-
117
+ Cannot find method `initialize` of type `::IncompatibleChild` with compatible arity
118
+ Method types:
119
+ def initialize: (name: ::String) -> untyped
120
+ code: Ruby::IncompatibleArguments
@@ -0,0 +1,139 @@
1
+ ---
2
+ - file: a.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 4
7
+ character: 0
8
+ end:
9
+ line: 4
10
+ character: 5
11
+ severity: ERROR
12
+ message: |-
13
+ Cannot assign a value of type `::Integer` to a variable of type `::String`
14
+ ::Integer <: ::String
15
+ ::Numeric <: ::String
16
+ ::Object <: ::String
17
+ ::BasicObject <: ::String
18
+ code: Ruby::IncompatibleAssignment
19
+ - range:
20
+ start:
21
+ line: 6
22
+ character: 4
23
+ end:
24
+ line: 6
25
+ character: 5
26
+ severity: ERROR
27
+ message: Cannot detect the type of the expression
28
+ code: Ruby::FallbackAny
29
+ - range:
30
+ start:
31
+ line: 8
32
+ character: 7
33
+ end:
34
+ line: 8
35
+ character: 8
36
+ severity: ERROR
37
+ message: Cannot detect the type of the expression
38
+ code: Ruby::FallbackAny
39
+ - range:
40
+ start:
41
+ line: 14
42
+ character: 4
43
+ end:
44
+ line: 14
45
+ character: 9
46
+ severity: ERROR
47
+ message: |-
48
+ Cannot assign a value of type `::Integer` to a variable of type `::String`
49
+ ::Integer <: ::String
50
+ ::Numeric <: ::String
51
+ ::Object <: ::String
52
+ ::BasicObject <: ::String
53
+ code: Ruby::IncompatibleAssignment
54
+ - range:
55
+ start:
56
+ line: 16
57
+ character: 8
58
+ end:
59
+ line: 16
60
+ character: 9
61
+ severity: ERROR
62
+ message: Cannot detect the type of the expression
63
+ code: Ruby::FallbackAny
64
+ - range:
65
+ start:
66
+ line: 23
67
+ character: 0
68
+ end:
69
+ line: 23
70
+ character: 17
71
+ severity: ERROR
72
+ message: |-
73
+ Cannot assign a value of type `::Integer` to a variable of type `::String`
74
+ ::Integer <: ::String
75
+ ::Numeric <: ::String
76
+ ::Object <: ::String
77
+ ::BasicObject <: ::String
78
+ code: Ruby::IncompatibleAssignment
79
+ - range:
80
+ start:
81
+ line: 26
82
+ character: 4
83
+ end:
84
+ line: 26
85
+ character: 10
86
+ severity: ERROR
87
+ message: Cannot detect the type of the expression
88
+ code: Ruby::FallbackAny
89
+ - range:
90
+ start:
91
+ line: 26
92
+ character: 4
93
+ end:
94
+ line: 26
95
+ character: 15
96
+ severity: ERROR
97
+ message: Cannot detect the type of the expression
98
+ code: Ruby::FallbackAny
99
+ - range:
100
+ start:
101
+ line: 27
102
+ character: 0
103
+ end:
104
+ line: 27
105
+ character: 19
106
+ severity: ERROR
107
+ message: |-
108
+ Cannot assign a value of type `::Integer` to a variable of type `::String`
109
+ ::Integer <: ::String
110
+ ::Numeric <: ::String
111
+ ::Object <: ::String
112
+ ::BasicObject <: ::String
113
+ code: Ruby::IncompatibleAssignment
114
+ - file: b.rb
115
+ diagnostics:
116
+ - range:
117
+ start:
118
+ line: 3
119
+ character: 4
120
+ end:
121
+ line: 3
122
+ character: 17
123
+ severity: ERROR
124
+ message: |-
125
+ Cannot assign a value of type `::String` to a constant of type `::Integer`
126
+ ::String <: ::Integer
127
+ ::Object <: ::Integer
128
+ ::BasicObject <: ::Integer
129
+ code: Ruby::IncompatibleAssignment
130
+ - range:
131
+ start:
132
+ line: 5
133
+ character: 4
134
+ end:
135
+ line: 5
136
+ character: 8
137
+ severity: ERROR
138
+ message: Cannot find the declaration of constant `Baz2`
139
+ code: Ruby::UnknownConstantAssigned
@@ -0,0 +1,13 @@
1
+ ---
2
+ - file: a.rbs
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 4
7
+ character: 0
8
+ end:
9
+ line: 5
10
+ character: 3
11
+ severity: ERROR
12
+ message: Declaration of `::A` is duplicated
13
+ code: Ruby::DuplicatedDeclaration
@@ -0,0 +1,229 @@
1
+ ---
2
+ - file: duplicated-method-definition.rbs
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 2
7
+ character: 2
8
+ end:
9
+ line: 2
10
+ character: 21
11
+ severity: ERROR
12
+ message: Non-overloading method definition of `foo` in `::DuplicatedMethodDefinitionError`
13
+ cannot be duplicated
14
+ code: Ruby::DuplicatedMethodDefinition
15
+ - range:
16
+ start:
17
+ line: 6
18
+ character: 4
19
+ end:
20
+ line: 6
21
+ character: 21
22
+ severity: ERROR
23
+ message: Non-overloading method definition of `f` in `::DuplicatedMethodDefinitionError::_Hello`
24
+ cannot be duplicated
25
+ code: Ruby::DuplicatedMethodDefinition
26
+ - range:
27
+ start:
28
+ line: 18
29
+ character: 4
30
+ end:
31
+ line: 18
32
+ character: 23
33
+ severity: ERROR
34
+ message: Non-overloading method definition of `g` in `::DuplicatedMethodDefinitionError::A`
35
+ cannot be duplicated
36
+ code: Ruby::DuplicatedMethodDefinition
37
+ - file: generic-parameter-mismatch.rbs
38
+ diagnostics:
39
+ - range:
40
+ start:
41
+ line: 5
42
+ character: 2
43
+ end:
44
+ line: 6
45
+ character: 5
46
+ severity: ERROR
47
+ message: Different generic parameters are specified across definitions of `::GenericParameterMismatchError::Foo`
48
+ code: Ruby::GenericParameterMismatch
49
+ - file: invalid-method-overload.rbs
50
+ diagnostics:
51
+ - range:
52
+ start:
53
+ line: 2
54
+ character: 2
55
+ end:
56
+ line: 2
57
+ character: 27
58
+ severity: ERROR
59
+ message: Cannot find a non-overloading definition of `foo` in `::InvalidMethodOverload`
60
+ code: Ruby::InvalidMethodOverload
61
+ - file: invalid-type-application.rbs
62
+ diagnostics:
63
+ - range:
64
+ start:
65
+ line: 2
66
+ character: 13
67
+ end:
68
+ line: 2
69
+ character: 23
70
+ severity: ERROR
71
+ message: Type `::Integer` is not generic but used as a generic type with 1 arguments
72
+ code: Ruby::InvalidTypeApplication
73
+ - range:
74
+ start:
75
+ line: 4
76
+ character: 13
77
+ end:
78
+ line: 4
79
+ character: 24
80
+ severity: ERROR
81
+ message: Type `::Array` expects 1 arguments, but 2 arguments are given
82
+ code: Ruby::InvalidTypeApplication
83
+ - range:
84
+ start:
85
+ line: 6
86
+ character: 13
87
+ end:
88
+ line: 6
89
+ character: 17
90
+ severity: ERROR
91
+ message: Type `::Hash` is generic but used as a non generic type
92
+ code: Ruby::InvalidTypeApplication
93
+ - file: invalid_variance_annotation.rbs
94
+ diagnostics:
95
+ - range:
96
+ start:
97
+ line: 2
98
+ character: 11
99
+ end:
100
+ line: 2
101
+ character: 22
102
+ severity: ERROR
103
+ message: The variance of type parameter `A` is covariant, but used in incompatible
104
+ position here
105
+ code: Ruby::InvalidVarianceAnnotation
106
+ - file: recursive-alias.rbs
107
+ diagnostics:
108
+ - range:
109
+ start:
110
+ line: 2
111
+ character: 2
112
+ end:
113
+ line: 2
114
+ character: 15
115
+ severity: ERROR
116
+ message: 'Circular method alias is detected in `::RecursiveAlias`: foo -> bar
117
+ -> baz'
118
+ code: Ruby::RecursiveAlias
119
+ - file: recursive-class.rbs
120
+ diagnostics:
121
+ - range:
122
+ start:
123
+ line: 1
124
+ character: 0
125
+ end:
126
+ line: 2
127
+ character: 3
128
+ severity: ERROR
129
+ message: 'Circular inheritance/mix-in is detected: ::Foo <: ::Bar <: ::Baz <:
130
+ ::Foo'
131
+ code: Ruby::RecursiveAncestor
132
+ - range:
133
+ start:
134
+ line: 4
135
+ character: 0
136
+ end:
137
+ line: 5
138
+ character: 3
139
+ severity: ERROR
140
+ message: 'Circular inheritance/mix-in is detected: ::Bar <: ::Baz <: ::Foo <:
141
+ ::Bar'
142
+ code: Ruby::RecursiveAncestor
143
+ - range:
144
+ start:
145
+ line: 7
146
+ character: 0
147
+ end:
148
+ line: 8
149
+ character: 3
150
+ severity: ERROR
151
+ message: 'Circular inheritance/mix-in is detected: ::Baz <: ::Foo <: ::Bar <:
152
+ ::Baz'
153
+ code: Ruby::RecursiveAncestor
154
+ - file: superclass-mismatch.rbs
155
+ diagnostics:
156
+ - range:
157
+ start:
158
+ line: 2
159
+ character: 2
160
+ end:
161
+ line: 3
162
+ character: 5
163
+ severity: ERROR
164
+ message: Different superclasses are specified for `::SuperclassMismatch::Foo`
165
+ code: Ruby::SuperclassMismatch
166
+ - file: unknown-method-alias.rbs
167
+ diagnostics:
168
+ - range:
169
+ start:
170
+ line: 2
171
+ character: 2
172
+ end:
173
+ line: 2
174
+ character: 15
175
+ severity: ERROR
176
+ message: Cannot find the original method `bar` in `::UnknownMethodAlias`
177
+ code: Ruby::UnknownMethodAlias
178
+ - file: unknown-type-name.rbs
179
+ diagnostics:
180
+ - range:
181
+ start:
182
+ line: 2
183
+ character: 13
184
+ end:
185
+ line: 2
186
+ character: 16
187
+ severity: ERROR
188
+ message: Cannot find type `::bar`
189
+ code: Ruby::UnknownTypeName
190
+ - range:
191
+ start:
192
+ line: 4
193
+ character: 9
194
+ end:
195
+ line: 4
196
+ character: 14
197
+ severity: ERROR
198
+ message: Cannot find type `::World`
199
+ code: Ruby::UnknownTypeName
200
+ - range:
201
+ start:
202
+ line: 6
203
+ character: 2
204
+ end:
205
+ line: 6
206
+ character: 15
207
+ severity: ERROR
208
+ message: Cannot find type `World`
209
+ code: Ruby::UnknownTypeName
210
+ - range:
211
+ start:
212
+ line: 8
213
+ character: 2
214
+ end:
215
+ line: 9
216
+ character: 5
217
+ severity: ERROR
218
+ message: Cannot find type `ABC`
219
+ code: Ruby::UnknownTypeName
220
+ - range:
221
+ start:
222
+ line: 11
223
+ character: 15
224
+ end:
225
+ line: 11
226
+ character: 18
227
+ severity: ERROR
228
+ message: Cannot find type `ZZZ`
229
+ code: Ruby::UnknownTypeName