steep 0.40.0 → 0.44.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -0
  3. data/Gemfile +1 -0
  4. data/bin/output_rebaseline.rb +15 -30
  5. data/bin/output_test.rb +23 -57
  6. data/lib/steep.rb +89 -15
  7. data/lib/steep/annotation_parser.rb +10 -2
  8. data/lib/steep/ast/types/class.rb +4 -0
  9. data/lib/steep/cli.rb +31 -6
  10. data/lib/steep/diagnostic/ruby.rb +13 -8
  11. data/lib/steep/diagnostic/signature.rb +152 -2
  12. data/lib/steep/drivers/annotations.rb +18 -36
  13. data/lib/steep/drivers/check.rb +140 -31
  14. data/lib/steep/drivers/diagnostic_printer.rb +20 -11
  15. data/lib/steep/drivers/langserver.rb +4 -8
  16. data/lib/steep/drivers/print_project.rb +10 -9
  17. data/lib/steep/drivers/stats.rb +135 -119
  18. data/lib/steep/drivers/utils/driver_helper.rb +35 -0
  19. data/lib/steep/drivers/utils/jobs_count.rb +9 -0
  20. data/lib/steep/drivers/validate.rb +29 -18
  21. data/lib/steep/drivers/watch.rb +55 -49
  22. data/lib/steep/drivers/worker.rb +11 -8
  23. data/lib/steep/expectations.rb +159 -0
  24. data/lib/steep/index/signature_symbol_provider.rb +23 -1
  25. data/lib/steep/index/source_index.rb +55 -5
  26. data/lib/steep/interface/block.rb +4 -0
  27. data/lib/steep/project.rb +0 -30
  28. data/lib/steep/project/dsl.rb +5 -3
  29. data/lib/steep/project/pattern.rb +56 -0
  30. data/lib/steep/project/target.rb +11 -227
  31. data/lib/steep/server/base_worker.rb +1 -3
  32. data/lib/steep/server/change_buffer.rb +63 -0
  33. data/lib/steep/server/interaction_worker.rb +72 -57
  34. data/lib/steep/server/master.rb +652 -234
  35. data/lib/steep/server/type_check_worker.rb +304 -0
  36. data/lib/steep/server/worker_process.rb +16 -11
  37. data/lib/steep/{project → services}/completion_provider.rb +5 -5
  38. data/lib/steep/services/content_change.rb +61 -0
  39. data/lib/steep/services/file_loader.rb +48 -0
  40. data/lib/steep/services/goto_service.rb +321 -0
  41. data/lib/steep/{project → services}/hover_content.rb +19 -20
  42. data/lib/steep/services/path_assignment.rb +27 -0
  43. data/lib/steep/services/signature_service.rb +403 -0
  44. data/lib/steep/services/stats_calculator.rb +69 -0
  45. data/lib/steep/services/type_check_service.rb +413 -0
  46. data/lib/steep/signature/validator.rb +187 -85
  47. data/lib/steep/source.rb +21 -18
  48. data/lib/steep/subtyping/check.rb +246 -45
  49. data/lib/steep/subtyping/constraints.rb +4 -4
  50. data/lib/steep/type_construction.rb +428 -193
  51. data/lib/steep/type_inference/block_params.rb +1 -1
  52. data/lib/steep/type_inference/context.rb +22 -0
  53. data/lib/steep/type_inference/local_variable_type_env.rb +26 -12
  54. data/lib/steep/type_inference/logic.rb +1 -1
  55. data/lib/steep/type_inference/logic_type_interpreter.rb +4 -4
  56. data/lib/steep/type_inference/type_env.rb +43 -17
  57. data/lib/steep/version.rb +1 -1
  58. data/smoke/alias/test_expectations.yml +96 -0
  59. data/smoke/and/test_expectations.yml +31 -0
  60. data/smoke/array/test_expectations.yml +103 -0
  61. data/smoke/block/test_expectations.yml +125 -0
  62. data/smoke/case/test_expectations.yml +47 -0
  63. data/smoke/class/test_expectations.yml +120 -0
  64. data/smoke/const/test_expectations.yml +129 -0
  65. data/smoke/diagnostics-rbs-duplicated/test_expectations.yml +13 -0
  66. data/smoke/diagnostics-rbs/Steepfile +7 -4
  67. data/smoke/diagnostics-rbs/test_expectations.yml +231 -0
  68. data/smoke/diagnostics-rbs/unknown-type-name-2.rbs +5 -0
  69. data/smoke/{broken → diagnostics-ruby-unsat}/Steepfile +0 -0
  70. data/smoke/diagnostics-ruby-unsat/a.rbs +3 -0
  71. data/smoke/diagnostics-ruby-unsat/test_expectations.yml +27 -0
  72. data/smoke/{diagnostics → diagnostics-ruby-unsat}/unsatisfiable_constraint.rb +0 -1
  73. data/smoke/diagnostics/a.rbs +0 -4
  74. data/smoke/diagnostics/test_expectations.yml +451 -0
  75. data/smoke/dstr/test_expectations.yml +13 -0
  76. data/smoke/ensure/test_expectations.yml +62 -0
  77. data/smoke/enumerator/test_expectations.yml +135 -0
  78. data/smoke/extension/f.rb +2 -0
  79. data/smoke/extension/f.rbs +3 -0
  80. data/smoke/extension/test_expectations.yml +73 -0
  81. data/smoke/hash/test_expectations.yml +81 -0
  82. data/smoke/hello/test_expectations.yml +25 -0
  83. data/smoke/if/test_expectations.yml +34 -0
  84. data/smoke/implements/b.rb +13 -0
  85. data/smoke/implements/b.rbs +12 -0
  86. data/smoke/implements/test_expectations.yml +23 -0
  87. data/smoke/initialize/test_expectations.yml +1 -0
  88. data/smoke/integer/test_expectations.yml +101 -0
  89. data/smoke/interface/test_expectations.yml +23 -0
  90. data/smoke/kwbegin/test_expectations.yml +17 -0
  91. data/smoke/lambda/test_expectations.yml +39 -0
  92. data/smoke/literal/test_expectations.yml +106 -0
  93. data/smoke/map/test_expectations.yml +1 -0
  94. data/smoke/method/test_expectations.yml +90 -0
  95. data/smoke/module/test_expectations.yml +75 -0
  96. data/smoke/regexp/test_expectations.yml +615 -0
  97. data/smoke/regression/issue_328.rb +1 -0
  98. data/smoke/regression/issue_328.rbs +0 -0
  99. data/smoke/regression/issue_332.rb +11 -0
  100. data/smoke/regression/issue_332.rbs +19 -0
  101. data/smoke/regression/issue_372.rb +8 -0
  102. data/smoke/regression/issue_372.rbs +4 -0
  103. data/smoke/regression/masgn.rb +4 -0
  104. data/smoke/regression/test_expectations.yml +60 -0
  105. data/smoke/regression/thread.rb +7 -0
  106. data/smoke/rescue/test_expectations.yml +79 -0
  107. data/smoke/self/test_expectations.yml +23 -0
  108. data/smoke/skip/test_expectations.yml +23 -0
  109. data/smoke/stdout/test_expectations.yml +1 -0
  110. data/smoke/super/test_expectations.yml +69 -0
  111. data/smoke/toplevel/test_expectations.yml +15 -0
  112. data/smoke/tsort/Steepfile +2 -0
  113. data/smoke/tsort/test_expectations.yml +63 -0
  114. data/smoke/type_case/test_expectations.yml +48 -0
  115. data/smoke/unexpected/Steepfile +5 -0
  116. data/smoke/unexpected/test_expectations.yml +25 -0
  117. data/smoke/unexpected/unexpected.rb +1 -0
  118. data/smoke/unexpected/unexpected.rbs +3 -0
  119. data/smoke/yield/test_expectations.yml +68 -0
  120. data/steep.gemspec +4 -3
  121. metadata +127 -80
  122. data/lib/steep/project/file_loader.rb +0 -68
  123. data/lib/steep/project/signature_file.rb +0 -39
  124. data/lib/steep/project/source_file.rb +0 -129
  125. data/lib/steep/project/stats_calculator.rb +0 -80
  126. data/lib/steep/server/code_worker.rb +0 -150
  127. data/lib/steep/server/signature_worker.rb +0 -157
  128. data/lib/steep/server/utils.rb +0 -69
  129. data/smoke/alias/test.yaml +0 -73
  130. data/smoke/and/test.yaml +0 -24
  131. data/smoke/array/test.yaml +0 -80
  132. data/smoke/block/test.yaml +0 -96
  133. data/smoke/broken/broken.rb +0 -0
  134. data/smoke/broken/broken.rbs +0 -0
  135. data/smoke/broken/test.yaml +0 -6
  136. data/smoke/case/test.yaml +0 -36
  137. data/smoke/class/test.yaml +0 -89
  138. data/smoke/const/test.yaml +0 -96
  139. data/smoke/diagnostics-rbs-duplicated/test.yaml +0 -10
  140. data/smoke/diagnostics-rbs/test.yaml +0 -142
  141. data/smoke/diagnostics/test.yaml +0 -333
  142. data/smoke/dstr/test.yaml +0 -10
  143. data/smoke/ensure/test.yaml +0 -47
  144. data/smoke/enumerator/test.yaml +0 -100
  145. data/smoke/extension/test.yaml +0 -50
  146. data/smoke/hash/test.yaml +0 -62
  147. data/smoke/hello/test.yaml +0 -18
  148. data/smoke/if/test.yaml +0 -27
  149. data/smoke/implements/test.yaml +0 -16
  150. data/smoke/initialize/test.yaml +0 -4
  151. data/smoke/integer/test.yaml +0 -66
  152. data/smoke/interface/test.yaml +0 -16
  153. data/smoke/kwbegin/test.yaml +0 -14
  154. data/smoke/lambda/test.yaml +0 -28
  155. data/smoke/literal/test.yaml +0 -79
  156. data/smoke/map/test.yaml +0 -4
  157. data/smoke/method/test.yaml +0 -71
  158. data/smoke/module/test.yaml +0 -51
  159. data/smoke/regexp/test.yaml +0 -372
  160. data/smoke/regression/test.yaml +0 -38
  161. data/smoke/rescue/test.yaml +0 -60
  162. data/smoke/self/test.yaml +0 -16
  163. data/smoke/skip/test.yaml +0 -16
  164. data/smoke/stdout/test.yaml +0 -4
  165. data/smoke/super/test.yaml +0 -52
  166. data/smoke/toplevel/test.yaml +0 -12
  167. data/smoke/tsort/test.yaml +0 -32
  168. data/smoke/type_case/test.yaml +0 -33
  169. data/smoke/yield/test.yaml +0 -49
Binary file
Binary file
@@ -1,6 +0,0 @@
1
- ---
2
- test:
3
- broken.rbs:
4
- diagnostics: []
5
- broken.rb:
6
- diagnostics: []
data/smoke/case/test.yaml DELETED
@@ -1,36 +0,0 @@
1
- ---
2
- test:
3
- a.rb:
4
- diagnostics:
5
- - |
6
- a.rb:3:0: [error] Cannot assign a value of type `(::Integer | ::Array[::String] | nil | ::String)` to a variable of type `::Integer`
7
- │ (::Integer | ::Array[::String] | nil | ::String) <: ::Integer
8
- │ ::Array[::String] <: ::Integer
9
- │ ::Object <: ::Integer
10
- │ ::BasicObject <: ::Integer
11
-
12
- │ Diagnostic ID: Ruby::IncompatibleAssignment
13
-
14
- └ a = case 1
15
- ~~~~~~~~~~
16
- - |
17
- a.rb:16:9: [error] Cannot find compatible overloading of method `+` of type `::Integer`
18
- │ Method types:
19
- │ def +: (::Integer) -> ::Integer
20
- │ | (::Float) -> ::Float
21
- │ | (::Rational) -> ::Rational
22
- │ | (::Complex) -> ::Complex
23
-
24
- │ Diagnostic ID: Ruby::UnresolvedOverloading
25
-
26
- └ when 1+"a"
27
- ~~~~~
28
- - |
29
- a.rb:15:0: [error] Cannot assign a value of type `(::Integer | nil)` to a variable of type `::Integer`
30
- │ (::Integer | nil) <: ::Integer
31
- │ nil <: ::Integer
32
-
33
- │ Diagnostic ID: Ruby::IncompatibleAssignment
34
-
35
- └ a = case
36
- ~~~~~~~~
@@ -1,89 +0,0 @@
1
- ---
2
- test:
3
- a.rb:
4
- diagnostics:
5
- - |
6
- a.rb:8:9: [error] Method parameters are incompatible with declaration `() -> ::String`
7
- │ Diagnostic ID: Ruby::MethodArityMismatch
8
-
9
- └ def bar(y)
10
- ~~~
11
- - |
12
- a.rb:13:2: [error] Cannot allow method body have type `::Integer` because declared as type `::String`
13
- │ ::Integer <: ::String
14
- │ ::Numeric <: ::String
15
- │ ::Object <: ::String
16
- │ ::BasicObject <: ::String
17
-
18
- │ Diagnostic ID: Ruby::MethodBodyTypeMismatch
19
-
20
- └ def to_s
21
- ~~~~~~~~
22
- - |
23
- a.rb:22:2: [error] Cannot allow method body have type `::String` because declared as type `::Integer`
24
- │ ::String <: ::Integer
25
- │ ::Object <: ::Integer
26
- │ ::BasicObject <: ::Integer
27
-
28
- │ Diagnostic ID: Ruby::MethodBodyTypeMismatch
29
-
30
- └ def self.baz
31
- ~~~~~~~~~~~~
32
- b.rb:
33
- diagnostics: []
34
- c.rb:
35
- diagnostics:
36
- - |
37
- c.rb:1:6: [error] @dynamic annotation contains unknown method name `type`
38
- │ Diagnostic ID: Ruby::UnexpectedDynamicMethod
39
-
40
- └ class B
41
- ~
42
- f.rb:
43
- diagnostics:
44
- - |
45
- f.rb:9:0: [error] Cannot assign a value of type `::_E` to a variable of type `::D`
46
- │ ::_E <: ::D
47
-
48
- │ Diagnostic ID: Ruby::IncompatibleAssignment
49
-
50
- └ d = e
51
- ~~~~~
52
- g.rb:
53
- diagnostics:
54
- - |
55
- g.rb:1:6: [error] Cannot find implementation of method `::B#name`
56
- │ Diagnostic ID: Ruby::MethodDefinitionMissing
57
-
58
- └ class B
59
- ~
60
- - |
61
- g.rb:4:6: [error] Cannot find implementation of method `::B#name`
62
- │ Diagnostic ID: Ruby::MethodDefinitionMissing
63
-
64
- └ class C
65
- ~
66
- h.rb:
67
- diagnostics: []
68
- i.rb:
69
- diagnostics:
70
- - |
71
- i.rb:4:4: [error] Cannot assign a value of type `::Integer` to a variable of type `::Symbol`
72
- │ ::Integer <: ::Symbol
73
- │ ::Numeric <: ::Symbol
74
- │ ::Object <: ::Symbol
75
- │ ::BasicObject <: ::Symbol
76
-
77
- │ Diagnostic ID: Ruby::IncompatibleAssignment
78
-
79
- └ x = super()
80
- ~~~~~~~~~~~
81
- - |
82
- i.rb:10:4: [error] Cannot find method `initialize` of type `::IncompatibleChild` with compatible arity
83
- │ Method types:
84
- │ def initialize: (name: ::String) -> untyped
85
-
86
- │ Diagnostic ID: Ruby::IncompatibleArguments
87
-
88
- └ super()
89
- ~~~~~~~
@@ -1,96 +0,0 @@
1
- ---
2
- test:
3
- a.rb:
4
- diagnostics:
5
- - |
6
- a.rb:4:0: [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 = A
15
- ~~~~~
16
- - |
17
- a.rb:6:4: [error] Cannot detect the type of the expression
18
- │ Diagnostic ID: Ruby::FallbackAny
19
-
20
- └ x = B
21
- ~
22
- - |
23
- a.rb:8:7: [error] Cannot detect the type of the expression
24
- │ Diagnostic ID: Ruby::FallbackAny
25
-
26
- └ module X
27
- ~
28
- - |
29
- a.rb:14:4: [error] Cannot assign a value of type `::Integer` to a variable of type `::String`
30
- │ ::Integer <: ::String
31
- │ ::Numeric <: ::String
32
- │ ::Object <: ::String
33
- │ ::BasicObject <: ::String
34
-
35
- │ Diagnostic ID: Ruby::IncompatibleAssignment
36
-
37
- └ x = A
38
- ~~~~~
39
- - |
40
- a.rb:16:8: [error] Cannot detect the type of the expression
41
- │ Diagnostic ID: Ruby::FallbackAny
42
-
43
- └ x = B
44
- ~
45
- - |
46
- a.rb:23:0: [error] Cannot assign a value of type `::Integer` to a variable of type `::String`
47
- │ ::Integer <: ::String
48
- │ ::Numeric <: ::String
49
- │ ::Object <: ::String
50
- │ ::BasicObject <: ::String
51
-
52
- │ Diagnostic ID: Ruby::IncompatibleAssignment
53
-
54
- └ x = Foo::Bar::Baz
55
- ~~~~~~~~~~~~~~~~~
56
- - |
57
- a.rb:26:4: [error] Cannot detect the type of the expression
58
- │ Diagnostic ID: Ruby::FallbackAny
59
-
60
- └ x = z::Bar::Baz
61
- ~~~~~~
62
- - |
63
- a.rb:26:4: [error] Cannot detect the type of the expression
64
- │ Diagnostic ID: Ruby::FallbackAny
65
-
66
- └ x = z::Bar::Baz
67
- ~~~~~~~~~~~
68
- - |
69
- a.rb:27:0: [error] Cannot assign a value of type `::Integer` to a variable of type `::String`
70
- │ ::Integer <: ::String
71
- │ ::Numeric <: ::String
72
- │ ::Object <: ::String
73
- │ ::BasicObject <: ::String
74
-
75
- │ Diagnostic ID: Ruby::IncompatibleAssignment
76
-
77
- └ x = ::Foo::Bar::Baz
78
- ~~~~~~~~~~~~~~~~~~~
79
- b.rb:
80
- diagnostics:
81
- - |
82
- b.rb:3:4: [error] Cannot assign a value of type `::String` to a constant of type `::Integer`
83
- │ ::String <: ::Integer
84
- │ ::Object <: ::Integer
85
- │ ::BasicObject <: ::Integer
86
-
87
- │ Diagnostic ID: Ruby::IncompatibleAssignment
88
-
89
- └ Baz = "Hello"
90
- ~~~~~~~~~~~~~
91
- - |
92
- b.rb:5:4: [error] Cannot find the declaration of constant `Baz2`
93
- │ Diagnostic ID: Ruby::UnknownConstantAssigned
94
-
95
- └ Baz2 = "World"
96
- ~~~~
@@ -1,10 +0,0 @@
1
- ---
2
- test:
3
- a.rbs:
4
- diagnostics:
5
- - |
6
- a.rbs:4:0: [error] Declaration of `::A` is duplicated
7
- │ Diagnostic ID: Ruby::DuplicatedDeclaration
8
-
9
- └ module A
10
- ~~~~~~~~
@@ -1,142 +0,0 @@
1
- ---
2
- test:
3
- duplicated-method-definition.rbs:
4
- diagnostics:
5
- - |
6
- duplicated-method-definition.rbs:2:2: [error] Non-overloading method definition of `foo` in `::DuplicatedMethodDefinitionError` cannot be duplicated
7
- │ Diagnostic ID: Ruby::DuplicatedMethodDefinition
8
-
9
- └ def foo: () -> void
10
- ~~~~~~~~~~~~~~~~~~~
11
- - |
12
- duplicated-method-definition.rbs:18:4: [error] Non-overloading method definition of `g` in `::DuplicatedMethodDefinitionError::A` cannot be duplicated
13
- │ Diagnostic ID: Ruby::DuplicatedMethodDefinition
14
-
15
- └ def g: () -> String
16
- ~~~~~~~~~~~~~~~~~~~
17
- - |
18
- duplicated-method-definition.rbs:6:4: [error] Non-overloading method definition of `f` in `::DuplicatedMethodDefinitionError::_Hello` cannot be duplicated
19
- │ Diagnostic ID: Ruby::DuplicatedMethodDefinition
20
-
21
- └ def f: () -> void
22
- ~~~~~~~~~~~~~~~~~
23
- generic-parameter-mismatch.rbs:
24
- diagnostics:
25
- - |
26
- generic-parameter-mismatch.rbs:5:2: [error] Different generic parameters are specified across definitions of `::GenericParameterMismatchError::Foo`
27
- │ Diagnostic ID: Ruby::GenericParameterMismatch
28
-
29
- └ class Foo[A, B]
30
- ~~~~~~~~~~~~~~~
31
- invalid-method-overload.rbs:
32
- diagnostics:
33
- - |
34
- invalid-method-overload.rbs:2:2: [error] Cannot find a non-overloading definition of `foo` in `::InvalidMethodOverload`
35
- │ Diagnostic ID: Ruby::InvalidMethodOverload
36
-
37
- └ def foo: () -> void | ...
38
- ~~~~~~~~~~~~~~~~~~~~~~~~~
39
- invalid-type-application.rbs:
40
- diagnostics:
41
- - |
42
- invalid-type-application.rbs:2:13: [error] Type `::Integer` is not generic but used as a generic type with 1 arguments
43
- │ Diagnostic ID: Ruby::InvalidTypeApplication
44
-
45
- └ type foo = Integer[3]
46
- ~~~~~~~~~~
47
- - |
48
- invalid-type-application.rbs:4:13: [error] Type `::Array` expects 1 arguments, but 2 arguments are given
49
- │ Diagnostic ID: Ruby::InvalidTypeApplication
50
-
51
- └ type bar = Array[1, 2]
52
- ~~~~~~~~~~~
53
- - |
54
- invalid-type-application.rbs:6:13: [error] Type `::Hash` is generic but used as a non generic type
55
- │ Diagnostic ID: Ruby::InvalidTypeApplication
56
-
57
- └ type baz = Hash
58
- ~~~~
59
- invalid_variance_annotation.rbs:
60
- diagnostics:
61
- - |
62
- invalid_variance_annotation.rbs:2:11: [error] The variance of type parameter `A` is covariant, but used in incompatible position here
63
- │ Diagnostic ID: Ruby::InvalidVarianceAnnotation
64
-
65
- └ def foo: (A) -> void
66
- ~~~~~~~~~~~
67
- recursive-alias.rbs:
68
- diagnostics:
69
- - |
70
- recursive-alias.rbs:2:2: [error] Circular method alias is detected in `::RecursiveAlias`: foo -> bar -> baz
71
- │ Diagnostic ID: Ruby::RecursiveAlias
72
-
73
- └ alias foo bar
74
- ~~~~~~~~~~~~~
75
- recursive-class.rbs:
76
- diagnostics:
77
- - |
78
- recursive-class.rbs:1:0: [error] Circular inheritance/mix-in is detected: ::Foo <: ::Bar <: ::Baz <: ::Foo
79
- │ Diagnostic ID: Ruby::RecursiveAncestor
80
-
81
- └ class Foo < Bar
82
- ~~~~~~~~~~~~~~~
83
- - |
84
- recursive-class.rbs:4:0: [error] Circular inheritance/mix-in is detected: ::Bar <: ::Baz <: ::Foo <: ::Bar
85
- │ Diagnostic ID: Ruby::RecursiveAncestor
86
-
87
- └ class Bar < Baz
88
- ~~~~~~~~~~~~~~~
89
- - |
90
- recursive-class.rbs:7:0: [error] Circular inheritance/mix-in is detected: ::Baz <: ::Foo <: ::Bar <: ::Baz
91
- │ Diagnostic ID: Ruby::RecursiveAncestor
92
-
93
- └ class Baz < Foo
94
- ~~~~~~~~~~~~~~~
95
- superclass-mismatch.rbs:
96
- diagnostics:
97
- - |
98
- superclass-mismatch.rbs:2:2: [error] Different superclasses are specified for `::SuperclassMismatch::Foo`
99
- │ Diagnostic ID: Ruby::SuperclassMismatch
100
-
101
- └ class Foo < String
102
- ~~~~~~~~~~~~~~~~~~
103
- unknown-method-alias.rbs:
104
- diagnostics:
105
- - |
106
- unknown-method-alias.rbs:2:2: [error] Cannot find the original method `bar` in `::UnknownMethodAlias`
107
- │ Diagnostic ID: Ruby::UnknownMethodAlias
108
-
109
- └ alias foo bar
110
- ~~~~~~~~~~~~~
111
- unknown-type-name.rbs:
112
- diagnostics:
113
- - |
114
- unknown-type-name.rbs:6:2: [error] Cannot find type `World`
115
- │ Diagnostic ID: Ruby::UnknownTypeName
116
-
117
- └ include World
118
- ~~~~~~~~~~~~~
119
- - |
120
- unknown-type-name.rbs:8:2: [error] Cannot find type `ABC`
121
- │ Diagnostic ID: Ruby::UnknownTypeName
122
-
123
- └ class Foo < ABC
124
- ~~~~~~~~~~~~~~~
125
- - |
126
- unknown-type-name.rbs:11:15: [error] Cannot find type `ZZZ`
127
- │ Diagnostic ID: Ruby::UnknownTypeName
128
-
129
- └ module Bar : ZZZ
130
- ~~~
131
- - |
132
- unknown-type-name.rbs:4:9: [error] Cannot find type `::World`
133
- │ Diagnostic ID: Ruby::UnknownTypeName
134
-
135
- └ Hello: World
136
- ~~~~~
137
- - |
138
- unknown-type-name.rbs:2:13: [error] Cannot find type `::bar`
139
- │ Diagnostic ID: Ruby::UnknownTypeName
140
-
141
- └ type foo = bar
142
- ~~~
@@ -1,333 +0,0 @@
1
- ---
2
- test:
3
- argument_type_mismatch.rb:
4
- diagnostics:
5
- - |
6
- argument_type_mismatch.rb:1:9: [error] Cannot pass a value of type `::String` as an argument of type `::int`
7
- │ ::String <: ::int
8
- │ ::String <: (::Integer | ::_ToInt)
9
- │ ::String <: ::Integer
10
- │ ::Object <: ::Integer
11
- │ ::BasicObject <: ::Integer
12
-
13
- │ Diagnostic ID: Ruby::ArgumentTypeMismatch
14
-
15
- └ [123].at("")
16
- ~~
17
- block_body_type_mismatch.rb:
18
- diagnostics:
19
- - |
20
- block_body_type_mismatch.rb:1:30: [error] Cannot allow block body have type `::String` because declared as type `::Integer`
21
- │ ::String <: ::Integer
22
- │ ::Object <: ::Integer
23
- │ ::BasicObject <: ::Integer
24
-
25
- │ Diagnostic ID: Ruby::BlockBodyTypeMismatch
26
-
27
- └ BlockBodyTypeMismatch.new.foo { "" }
28
- ~~~~~~
29
- block_type_mismatch.rb:
30
- diagnostics:
31
- - |
32
- block_type_mismatch.rb:3:8: [error] Cannot pass a value of type `^(untyped, untyped, untyped) -> untyped` as a block-pass-argument of type `^(::Integer) -> void`
33
- │ ^(untyped, untyped, untyped) -> untyped <: ^(::Integer) -> void
34
-
35
- │ Diagnostic ID: Ruby::BlockTypeMismatch
36
-
37
- └ 123.tap(&lam)
38
- ~~~~
39
- break_type_mismatch.rb:
40
- diagnostics:
41
- - |
42
- break_type_mismatch.rb:1:10: [error] Cannot break with a value of type `::String` because type `::Integer` is assumed
43
- │ ::String <: ::Integer
44
- │ ::Object <: ::Integer
45
- │ ::BasicObject <: ::Integer
46
-
47
- │ Diagnostic ID: Ruby::BreakTypeMismatch
48
-
49
- └ 123.tap { break "" }
50
- ~~~~~~~~
51
- else_on_exhaustive_case.rb:
52
- diagnostics:
53
- - |
54
- else_on_exhaustive_case.rb:11:2: [error] The branch is unreachable because the condition is exhaustive
55
- │ Diagnostic ID: Ruby::ElseOnExhaustiveCase
56
-
57
- └ raise "Unexpected value"
58
- ~~~~~~~~~~~~~~~~~~~~~~~~
59
- incompatible_annotation.rb:
60
- diagnostics:
61
- - |
62
- incompatible_annotation.rb:5:2: [error] Type annotation about `a` is incompatible since ::String <: ::Array[::Integer] doesn't hold
63
- │ ::String <: ::Array[::Integer]
64
- │ ::Object <: ::Array[::Integer]
65
- │ ::BasicObject <: ::Array[::Integer]
66
-
67
- │ Diagnostic ID: Ruby::IncompatibleAnnotation
68
-
69
- └ a + ""
70
- ~~~~~~
71
- incompatible_argument.rb:
72
- diagnostics:
73
- - |
74
- incompatible_argument.rb:1:6: [error] Cannot find method `at` of type `::Array[::Integer]` with compatible arity
75
- │ Method types:
76
- │ def at: (::int) -> (::Integer | nil)
77
-
78
- │ Diagnostic ID: Ruby::IncompatibleArguments
79
-
80
- └ [123].at(1,2,3)
81
- ~~
82
- incompatible_assignment.rb:
83
- diagnostics:
84
- - |
85
- incompatible_assignment.rb:2:0: [error] Cannot assign a value of type `::Integer` to a variable of type `::String`
86
- │ ::Integer <: ::String
87
- │ ::Numeric <: ::String
88
- │ ::Object <: ::String
89
- │ ::BasicObject <: ::String
90
-
91
- │ Diagnostic ID: Ruby::IncompatibleAssignment
92
-
93
- └ x = 3
94
- ~~~~~
95
- - |
96
- incompatible_assignment.rb:5:0: [error] Cannot assign a value of type `::Integer` to a constant of type `::String`
97
- │ ::Integer <: ::String
98
- │ ::Numeric <: ::String
99
- │ ::Object <: ::String
100
- │ ::BasicObject <: ::String
101
-
102
- │ Diagnostic ID: Ruby::IncompatibleAssignment
103
-
104
- └ X = 123
105
- ~~~~~~~
106
- - |
107
- incompatible_assignment.rb:8:0: [error] Cannot assign a value of type `::Symbol` to a variable of type `::Integer`
108
- │ ::Symbol <: ::Integer
109
- │ ::Object <: ::Integer
110
- │ ::BasicObject <: ::Integer
111
-
112
- │ Diagnostic ID: Ruby::IncompatibleAssignment
113
-
114
- └ @x = :foo
115
- ~~~~~~~~~
116
- method_arity_mismatch.rb:
117
- diagnostics:
118
- - |
119
- method_arity_mismatch.rb:3:9: [error] Method parameters are incompatible with declaration `() -> void`
120
- │ Diagnostic ID: Ruby::MethodArityMismatch
121
-
122
- └ def foo(x)
123
- ~~~
124
- - |
125
- method_arity_mismatch.rb:8:11: [error] Method parameters are incompatible with declaration `(::String) -> void`
126
- │ Diagnostic ID: Ruby::MethodArityMismatch
127
-
128
- └ def self.bar
129
- ~~~
130
- method_body_type_mismatch.rb:
131
- diagnostics:
132
- - |
133
- method_body_type_mismatch.rb:3:2: [error] Cannot allow method body have type `::String` because declared as type `::Integer`
134
- │ ::String <: ::Integer
135
- │ ::Object <: ::Integer
136
- │ ::BasicObject <: ::Integer
137
-
138
- │ Diagnostic ID: Ruby::MethodBodyTypeMismatch
139
-
140
- └ def foo
141
- ~~~~~~~
142
- method_definition_missing.rb:
143
- diagnostics:
144
- - |
145
- method_definition_missing.rb:1:6: [error] Cannot find implementation of method `::MethodDefinitionMissing#foo`
146
- │ Diagnostic ID: Ruby::MethodDefinitionMissing
147
-
148
- └ class MethodDefinitionMissing
149
- ~~~~~~~~~~~~~~~~~~~~~~~
150
- method_return_type_annotation_mismatch.rb:
151
- diagnostics:
152
- - |
153
- method_return_type_annotation_mismatch.rb:3:2: [error] Annotation `@type return` specifies type `::Integer` where declared as type `::String`
154
- │ ::Integer <: ::String
155
- │ ::Numeric <: ::String
156
- │ ::Object <: ::String
157
- │ ::BasicObject <: ::String
158
-
159
- │ Diagnostic ID: Ruby::MethodReturnTypeAnnotationMismatch
160
-
161
- └ def foo
162
- ~~~~~~~
163
- missing_keyword.rb:
164
- diagnostics:
165
- - |
166
- missing_keyword.rb:1:23: [error] Cannot omit required keywords: `foo`
167
- │ Diagnostic ID: Ruby::MissingKeyword
168
-
169
- └ MissingKeyword.new.foo bar: :bar
170
- ~~~~~~~~~
171
- no_method.rb:
172
- diagnostics:
173
- - |
174
- no_method.rb:1:2: [error] Type `::Integer` does not have method `foo`
175
- │ Diagnostic ID: Ruby::NoMethod
176
-
177
- └ 1.foo()
178
- ~~~
179
- required_block_missing.rb:
180
- diagnostics:
181
- - |
182
- required_block_missing.rb:1:4: [error] The method cannot be called without a block
183
- │ Diagnostic ID: Ruby::RequiredBlockMissing
184
-
185
- └ 123.tap()
186
- ~~~
187
- return_type_mismatch.rb:
188
- diagnostics:
189
- - |
190
- return_type_mismatch.rb:4:4: [error] The method cannot return a value of type `::Integer` because declared as type `::String`
191
- │ ::Integer <: ::String
192
- │ ::Numeric <: ::String
193
- │ ::Object <: ::String
194
- │ ::BasicObject <: ::String
195
-
196
- │ Diagnostic ID: Ruby::ReturnTypeMismatch
197
-
198
- └ return 30
199
- ~~~~~~~~~
200
- unexpected_block_given.rb:
201
- diagnostics:
202
- - |
203
- unexpected_block_given.rb:1:10: [error] The method cannot be called with a block
204
- │ Diagnostic ID: Ruby::UnexpectedBlockGiven
205
-
206
- └ [1].at(1) { 123 }
207
- ~~~~~~~
208
- unexpected_dynamic_method.rb:
209
- diagnostics:
210
- - |
211
- unexpected_dynamic_method.rb:1:6: [error] @dynamic annotation contains unknown method name `foo`
212
- │ Diagnostic ID: Ruby::UnexpectedDynamicMethod
213
-
214
- └ class UnexpectedDynamicMethod
215
- ~~~~~~~~~~~~~~~~~~~~~~~
216
- unexpected_jump.rb:
217
- diagnostics:
218
- - |
219
- unexpected_jump.rb:1:0: [error] Cannot jump from here
220
- │ Diagnostic ID: Ruby::UnexpectedJump
221
-
222
- └ break
223
- ~~~~~
224
- - |
225
- unexpected_jump.rb:3:0: [error] Cannot jump from here
226
- │ Diagnostic ID: Ruby::UnexpectedJump
227
-
228
- └ next
229
- ~~~~
230
- unexpected_jump_value.rb:
231
- diagnostics:
232
- - |
233
- unexpected_jump_value.rb:2:2: [error] The value given to break will be ignored
234
- │ Diagnostic ID: Ruby::UnexpectedJumpValue
235
-
236
- └ break 10
237
- ~~~~~~~~
238
- unexpected_keyword.rb:
239
- diagnostics:
240
- - |
241
- unexpected_keyword.rb:1:26: [error] Cannot specify unexpected keyword arguments: `bar`
242
- │ Diagnostic ID: Ruby::UnexpectedKeyword
243
-
244
- └ UnexpectedKeyword.new.foo(foo: 123, bar: :bar)
245
- ~~~~~~~~~~~~~~~~~~~
246
- unexpected_splat.rb:
247
- diagnostics:
248
- - |
249
- unexpected_splat.rb:1:13: [error] Hash splat is given with object other than `Hash[X, Y]`
250
- │ Diagnostic ID: Ruby::UnexpectedSplat
251
-
252
- └ { foo: :bar, **123 }
253
- ~~~~~
254
- unexpected_yield.rb:
255
- diagnostics:
256
- - |
257
- unexpected_yield.rb:4:4: [error] No block given for `yield`
258
- │ Diagnostic ID: Ruby::UnexpectedYield
259
-
260
- └ yield
261
- ~~~~~
262
- - |
263
- unexpected_yield.rb:4:4: [error] Cannot detect the type of the expression
264
- │ Diagnostic ID: Ruby::FallbackAny
265
-
266
- └ yield
267
- ~~~~~
268
- unknown_constant_assigned.rb:
269
- diagnostics:
270
- - |
271
- unknown_constant_assigned.rb:2:2: [error] Cannot find the declaration of constant `FOO`
272
- │ Diagnostic ID: Ruby::UnknownConstantAssigned
273
-
274
- └ FOO = 123
275
- ~~~
276
- - |
277
- unknown_constant_assigned.rb:4:2: [error] Cannot detect the type of the expression
278
- │ Diagnostic ID: Ruby::FallbackAny
279
-
280
- └ FOO::BAR = 123
281
- ~~~
282
- - |
283
- unknown_constant_assigned.rb:4:2: [error] Cannot find the declaration of constant `FOO::BAR`
284
- │ Diagnostic ID: Ruby::UnknownConstantAssigned
285
-
286
- └ FOO::BAR = 123
287
- ~~~~~~~~
288
- - |
289
- unknown_constant_assigned.rb:6:2: [error] Cannot find the declaration of constant `::FOO`
290
- │ Diagnostic ID: Ruby::UnknownConstantAssigned
291
-
292
- └ ::FOO = :foo
293
- ~~~~~
294
- unresolved_overloading.rb:
295
- diagnostics:
296
- - |
297
- unresolved_overloading.rb:1:0: [error] Cannot find compatible overloading of method `+` of type `::Integer`
298
- │ Method types:
299
- │ def +: (::Integer) -> ::Integer
300
- │ | (::Float) -> ::Float
301
- │ | (::Rational) -> ::Rational
302
- │ | (::Complex) -> ::Complex
303
-
304
- │ Diagnostic ID: Ruby::UnresolvedOverloading
305
-
306
- └ 1 + ""
307
- ~~~~~~
308
- unsatisfiable_constraint.rb:
309
- diagnostics:
310
- - |
311
- unsatisfiable_constraint.rb:6:4: [error] Type `::String` does not have method `foo`
312
- │ Diagnostic ID: Ruby::NoMethod
313
-
314
- └ x.foo()
315
- ~~~
316
- - |
317
- unsatisfiable_constraint.rb:4:0: [error] Unsatisfiable constraint `::Array[untyped] <: A(1) <: ::String` is generated through (A(1)) { (A(1)) -> void } -> B(2)
318
- │ ::Array[untyped] <: ::String
319
- │ ::Object <: ::String
320
- │ ::BasicObject <: ::String
321
-
322
- │ Diagnostic ID: Ruby::UnsatisfiableConstraint
323
-
324
- └ test.foo([]) do |x|
325
- ~~~~~~~~~~~~~~~~~~~
326
- unsupported_syntax.rb:
327
- diagnostics:
328
- - |
329
- unsupported_syntax.rb:1:0: [error] sclass receiver must be instance type or singleton type, but type given `(::Integer | ::String | nil)`
330
- │ Diagnostic ID: Ruby::UnsupportedSyntax
331
-
332
- └ class <<[1, ""].sample
333
- ~~~~~~~~~~~~~~~~~~~~~~