steep 0.40.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -61,7 +61,7 @@ module Steep
61
61
  return
62
62
  end
63
63
 
64
- type = annotations.var_type(lvar: var.name)
64
+ type = annotations.var_type(lvar: var)
65
65
 
66
66
  case arg.type
67
67
  when :arg, :procarg0
@@ -78,6 +78,28 @@ module Steep
78
78
  end
79
79
  end
80
80
  end
81
+
82
+ def update(
83
+ instance_type: self.instance_type,
84
+ module_type: self.module_type,
85
+ implement_name: self.implement_name,
86
+ current_namespace: self.current_namespace,
87
+ const_env: self.const_env,
88
+ class_name: self.class_name,
89
+ instance_definition: self.instance_definition,
90
+ module_definition: self.module_definition
91
+ )
92
+ ModuleContext.new(
93
+ instance_type: instance_type,
94
+ module_type: module_type,
95
+ implement_name: implement_name,
96
+ current_namespace: current_namespace,
97
+ const_env: const_env,
98
+ class_name: class_name,
99
+ instance_definition: instance_definition,
100
+ module_definition: module_definition
101
+ )
102
+ end
81
103
  end
82
104
 
83
105
  attr_reader :call_context
@@ -1,9 +1,6 @@
1
1
  module Steep
2
2
  module TypeInference
3
3
  class LocalVariableTypeEnv
4
- attr_reader :subtyping
5
- attr_reader :self_type
6
-
7
4
  class Entry
8
5
  attr_reader :type
9
6
  attr_reader :annotations
@@ -39,31 +36,46 @@ module Steep
39
36
  end
40
37
  end
41
38
 
39
+ attr_reader :subtyping
40
+ attr_reader :self_type
41
+ attr_reader :instance_type
42
+ attr_reader :class_type
42
43
  attr_reader :declared_types
43
44
  attr_reader :assigned_types
44
45
 
45
- def self.empty(subtyping:, self_type:)
46
- new(subtyping: subtyping, declared_types: {}, assigned_types: {}, self_type: self_type)
46
+ def self.empty(subtyping:, self_type:, instance_type:, class_type:)
47
+ new(
48
+ subtyping: subtyping,
49
+ declared_types: {},
50
+ assigned_types: {},
51
+ self_type: self_type,
52
+ instance_type: instance_type,
53
+ class_type: class_type
54
+ )
47
55
  end
48
56
 
49
- def initialize(subtyping:, declared_types:, assigned_types:, self_type:)
57
+ def initialize(subtyping:, declared_types:, assigned_types:, self_type:, instance_type:, class_type:)
50
58
  @subtyping = subtyping
51
59
  @self_type = self_type
52
60
 
53
61
  @declared_types = declared_types
54
62
  @assigned_types = assigned_types
63
+ @class_type = class_type
64
+ @instance_type = instance_type
55
65
 
56
66
  unless (intersection = Set.new(declared_types.keys) & Set.new(assigned_types.keys)).empty?
57
67
  raise "Declared types and assigned types should be disjoint: #{intersection}"
58
68
  end
59
69
  end
60
70
 
61
- def update(declared_types: self.declared_types, assigned_types: self.assigned_types, self_type: self.self_type)
71
+ def update(declared_types: self.declared_types, assigned_types: self.assigned_types, self_type: self.self_type, instance_type: self.instance_type, class_type: self.class_type)
62
72
  self.class.new(
63
73
  subtyping: subtyping,
64
74
  declared_types: declared_types,
65
75
  assigned_types: assigned_types,
66
- self_type: self_type
76
+ self_type: self_type,
77
+ instance_type: instance_type,
78
+ class_type: class_type
67
79
  )
68
80
  end
69
81
 
@@ -73,7 +85,7 @@ module Steep
73
85
  if declared_type
74
86
  relation = Subtyping::Relation.new(sub_type: type, super_type: declared_type)
75
87
  constraints = Subtyping::Constraints.new(unknowns: Set.new)
76
- subtyping.check(relation, constraints: constraints, self_type: self_type).else do |result|
88
+ subtyping.check(relation, constraints: constraints, self_type: self_type, instance_type: instance_type, class_type: class_type).else do |result|
77
89
  yield declared_type, type, result
78
90
  end
79
91
  end
@@ -89,7 +101,7 @@ module Steep
89
101
  if declared_type
90
102
  relation = Subtyping::Relation.new(sub_type: type, super_type: declared_type)
91
103
  constraints = Subtyping::Constraints.new(unknowns: Set.new)
92
- subtyping.check(relation, constraints: constraints, self_type: self_type).else do |result|
104
+ subtyping.check(relation, constraints: constraints, self_type: self_type, instance_type: instance_type, class_type: class_type).else do |result|
93
105
  yield declared_type, type, result
94
106
  end
95
107
 
@@ -113,7 +125,7 @@ module Steep
113
125
  if outer_type
114
126
  relation = Subtyping::Relation.new(sub_type: inner_type, super_type: outer_type)
115
127
  constraints = Subtyping::Constraints.new(unknowns: Set.new)
116
- subtyping.check(relation, constraints: constraints, self_type: self_type).else do |result|
128
+ subtyping.check(relation, constraints: constraints, self_type: self_type, instance_type: instance_type, class_type: class_type).else do |result|
117
129
  if block_given?
118
130
  yield var, outer_type, inner_type, result
119
131
  end
@@ -194,7 +206,9 @@ module Steep
194
206
  subtyping: subtyping,
195
207
  self_type: self_type,
196
208
  declared_types: declared_types,
197
- assigned_types: assigned_types
209
+ assigned_types: assigned_types,
210
+ instance_type: instance_type,
211
+ class_type: class_type
198
212
  )
199
213
  end
200
214
 
@@ -22,7 +22,7 @@ module Steep
22
22
  nodes.each do |node|
23
23
  case node.type
24
24
  when :lvar, :lvasgn
25
- vars << node.children[0].name
25
+ vars << node.children[0]
26
26
  end
27
27
  end
28
28
 
@@ -159,16 +159,16 @@ module Steep
159
159
  def decompose_value(node)
160
160
  case node.type
161
161
  when :lvar
162
- [node, Set[node.children[0].name]]
162
+ [node, Set[node.children[0]]]
163
163
  when :masgn
164
164
  lhs, rhs = node.children
165
- lhs_vars = lhs.children.select {|m| m.type == :lvasgn }.map {|m| m.children[0].name }
165
+ lhs_vars = lhs.children.select {|m| m.type == :lvasgn }.map {|m| m.children[0] }
166
166
  val, vars = decompose_value(rhs)
167
167
  [val, vars + lhs_vars]
168
168
  when :lvasgn
169
169
  var, rhs = node.children
170
170
  val, vars = decompose_value(rhs)
171
- [val, vars + [var.name]]
171
+ [val, vars + [var]]
172
172
  when :begin
173
173
  decompose_value(node.children.last)
174
174
  when :and
@@ -283,7 +283,7 @@ module Steep
283
283
 
284
284
  else
285
285
  relation = Subtyping::Relation.new(sub_type: type, super_type: instance_type)
286
- if subtyping.check(relation, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.new).success?
286
+ if subtyping.check(relation, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.new, instance_type: AST::Types::Instance.new, class_type: AST::Types::Class.new).success?
287
287
  [
288
288
  [type],
289
289
  []
@@ -38,19 +38,23 @@ module Steep
38
38
  end
39
39
  end
40
40
 
41
- def with_annotations(ivar_types: {}, const_types: {}, gvar_types: {}, self_type:, &block)
41
+ def with_annotations(ivar_types: {}, const_types: {}, gvar_types: {}, self_type:, instance_type:, class_type:, &block)
42
42
  dup.tap do |env|
43
- merge!(original_env: env.ivar_types, override_env: ivar_types, self_type: self_type, &block)
44
- merge!(original_env: env.gvar_types, override_env: gvar_types, self_type: self_type, &block)
43
+ merge!(original_env: env.ivar_types, override_env: ivar_types, self_type: self_type, instance_type: instance_type, class_type: class_type, &block)
44
+ merge!(original_env: env.gvar_types, override_env: gvar_types, self_type: self_type, instance_type: instance_type, class_type: class_type, &block)
45
45
 
46
46
  const_types.each do |name, annotated_type|
47
47
  original_type = self.const_types[name] || const_env.lookup(name)
48
48
  if original_type
49
- assert_annotation name,
50
- original_type: original_type,
51
- annotated_type: annotated_type,
52
- self_type: self_type,
53
- &block
49
+ assert_annotation(
50
+ name,
51
+ original_type: original_type,
52
+ annotated_type: annotated_type,
53
+ self_type: self_type,
54
+ instance_type: instance_type,
55
+ class_type: class_type,
56
+ &block
57
+ )
54
58
  end
55
59
  env.const_types[name] = annotated_type
56
60
  end
@@ -101,13 +105,20 @@ module Steep
101
105
  # @type method assign: (const: TypeName, type: AST::Type) { (Subtyping::Result::Failure | nil) -> void } -> AST::Type
102
106
  # | (gvar: Symbol, type: AST::Type) { (Subtyping::Result::Failure | nil) -> void } -> AST::Type
103
107
  # | (ivar: Symbol, type: AST::Type) { (Subtyping::Result::Failure | nil) -> void } -> AST::Type
104
- def assign(const: nil, gvar: nil, ivar: nil, type:, self_type:, &block)
108
+ def assign(const: nil, gvar: nil, ivar: nil, type:, self_type:, instance_type:, class_type:, &block)
105
109
  case
106
110
  when const
107
111
  yield_self do
108
112
  const_type = const_types[const] || const_env.lookup(const)
109
113
  if const_type
110
- assert_assign(var_type: const_type, lhs_type: type, self_type: self_type, &block)
114
+ assert_assign(
115
+ var_type: const_type,
116
+ lhs_type: type,
117
+ self_type: self_type,
118
+ instance_type: instance_type,
119
+ class_type: class_type,
120
+ &block
121
+ )
111
122
  else
112
123
  yield nil
113
124
  AST::Types::Any.new
@@ -116,7 +127,14 @@ module Steep
116
127
  else
117
128
  lookup_dictionary(ivar: ivar, gvar: gvar) do |var_name, dictionary|
118
129
  if dictionary.key?(var_name)
119
- assert_assign(var_type: dictionary[var_name], lhs_type: type, self_type: self_type, &block)
130
+ assert_assign(
131
+ var_type: dictionary[var_name],
132
+ lhs_type: type,
133
+ self_type: self_type,
134
+ instance_type: instance_type,
135
+ class_type: class_type,
136
+ &block
137
+ )
120
138
  else
121
139
  yield nil
122
140
  AST::Types::Any.new
@@ -134,7 +152,7 @@ module Steep
134
152
  end
135
153
  end
136
154
 
137
- def assert_assign(var_type:, lhs_type:, self_type:)
155
+ def assert_assign(var_type:, lhs_type:, self_type:, instance_type:, class_type:)
138
156
  return var_type if var_type == lhs_type
139
157
 
140
158
  var_type = subtyping.expand_alias(var_type)
@@ -143,20 +161,28 @@ module Steep
143
161
  relation = Subtyping::Relation.new(sub_type: lhs_type, super_type: var_type)
144
162
  constraints = Subtyping::Constraints.new(unknowns: Set.new)
145
163
 
146
- subtyping.check(relation, self_type: self_type, constraints: constraints).else do |result|
164
+ subtyping.check(relation, self_type: self_type, constraints: constraints, instance_type: instance_type, class_type: class_type).else do |result|
147
165
  yield result
148
166
  end
149
167
 
150
168
  var_type
151
169
  end
152
170
 
153
- def merge!(original_env:, override_env:, self_type:, &block)
171
+ def merge!(original_env:, override_env:, self_type:, instance_type:, class_type:, &block)
154
172
  original_env.merge!(override_env) do |name, original_type, override_type|
155
- assert_annotation name, annotated_type: override_type, original_type: original_type, self_type: self_type, &block
173
+ assert_annotation(
174
+ name,
175
+ annotated_type: override_type,
176
+ original_type: original_type,
177
+ self_type: self_type,
178
+ instance_type: instance_type,
179
+ class_type: class_type,
180
+ &block
181
+ )
156
182
  end
157
183
  end
158
184
 
159
- def assert_annotation(name, annotated_type:, original_type:, self_type:)
185
+ def assert_annotation(name, annotated_type:, original_type:, self_type:, instance_type:, class_type:)
160
186
  return annotated_type if annotated_type == original_type
161
187
 
162
188
  annotated_type = subtyping.expand_alias(annotated_type)
@@ -165,7 +191,7 @@ module Steep
165
191
  relation = Subtyping::Relation.new(sub_type: annotated_type, super_type: original_type)
166
192
  constraints = Subtyping::Constraints.new(unknowns: Set.new)
167
193
 
168
- subtyping.check(relation, constraints: constraints, self_type: self_type).else do |result|
194
+ subtyping.check(relation, constraints: constraints, self_type: self_type, instance_type: instance_type, class_type: class_type).else do |result|
169
195
  yield name, relation, result
170
196
  end
171
197
 
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "0.40.0"
2
+ VERSION = "0.44.0"
3
3
  end
@@ -0,0 +1,96 @@
1
+ ---
2
+ - file: a.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 4
7
+ character: 0
8
+ end:
9
+ line: 4
10
+ character: 7
11
+ severity: ERROR
12
+ message: |-
13
+ Cannot find compatible overloading of method `+` of type `(::String | ::Integer)`
14
+ Method types:
15
+ def +: ((::string & ::Integer)) -> (::String | ::Integer)
16
+ | ((::string & ::Float)) -> (::String | ::Float)
17
+ | ((::string & ::Rational)) -> (::String | ::Rational)
18
+ | ((::string & ::Complex)) -> (::String | ::Complex)
19
+ code: Ruby::UnresolvedOverloading
20
+ - range:
21
+ start:
22
+ line: 13
23
+ character: 2
24
+ end:
25
+ line: 13
26
+ character: 7
27
+ severity: ERROR
28
+ message: |-
29
+ Cannot assign a value of type `::String` to a variable of type `::Symbol`
30
+ ::String <: ::Symbol
31
+ ::Object <: ::Symbol
32
+ ::BasicObject <: ::Symbol
33
+ code: Ruby::IncompatibleAssignment
34
+ - range:
35
+ start:
36
+ line: 15
37
+ character: 2
38
+ end:
39
+ line: 15
40
+ character: 7
41
+ severity: ERROR
42
+ message: |-
43
+ Cannot assign a value of type `::Integer` to a variable of type `::Symbol`
44
+ ::Integer <: ::Symbol
45
+ ::Numeric <: ::Symbol
46
+ ::Object <: ::Symbol
47
+ ::BasicObject <: ::Symbol
48
+ code: Ruby::IncompatibleAssignment
49
+ - file: b.rb
50
+ diagnostics:
51
+ - range:
52
+ start:
53
+ line: 6
54
+ character: 0
55
+ end:
56
+ line: 6
57
+ character: 8
58
+ severity: ERROR
59
+ message: |-
60
+ Cannot assign a value of type `::String` to a variable of type `::Integer`
61
+ ::String <: ::Integer
62
+ ::Object <: ::Integer
63
+ ::BasicObject <: ::Integer
64
+ code: Ruby::IncompatibleAssignment
65
+ - file: c.rb
66
+ diagnostics:
67
+ - range:
68
+ start:
69
+ line: 3
70
+ character: 0
71
+ end:
72
+ line: 3
73
+ character: 32
74
+ severity: ERROR
75
+ message: |-
76
+ Cannot assign a value of type `::Integer` to a variable of type `::String`
77
+ ::Integer <: ::String
78
+ ::Numeric <: ::String
79
+ ::Object <: ::String
80
+ ::BasicObject <: ::String
81
+ code: Ruby::IncompatibleAssignment
82
+ - range:
83
+ start:
84
+ line: 8
85
+ character: 0
86
+ end:
87
+ line: 8
88
+ character: 32
89
+ severity: ERROR
90
+ message: |-
91
+ Cannot assign a value of type `::Integer` to a variable of type `::String`
92
+ ::Integer <: ::String
93
+ ::Numeric <: ::String
94
+ ::Object <: ::String
95
+ ::BasicObject <: ::String
96
+ code: Ruby::IncompatibleAssignment
@@ -0,0 +1,31 @@
1
+ ---
2
+ - file: a.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 6
7
+ character: 0
8
+ end:
9
+ line: 6
10
+ character: 17
11
+ severity: ERROR
12
+ message: |-
13
+ Cannot assign a value of type `(::String | nil)` to a variable of type `::String`
14
+ (::String | nil) <: ::String
15
+ nil <: ::String
16
+ code: Ruby::IncompatibleAssignment
17
+ - range:
18
+ start:
19
+ line: 8
20
+ character: 0
21
+ end:
22
+ line: 8
23
+ character: 17
24
+ severity: ERROR
25
+ message: |-
26
+ Cannot assign a value of type `(::String | nil)` to a variable of type `::Integer`
27
+ (::String | nil) <: ::Integer
28
+ ::String <: ::Integer
29
+ ::Object <: ::Integer
30
+ ::BasicObject <: ::Integer
31
+ code: Ruby::IncompatibleAssignment
@@ -0,0 +1,103 @@
1
+ ---
2
+ - file: a.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 6
7
+ character: 0
8
+ end:
9
+ line: 6
10
+ character: 12
11
+ severity: ERROR
12
+ message: |-
13
+ Cannot find compatible overloading of method `[]=` of type `::Array[::Integer]`
14
+ Method types:
15
+ def []=: (::int, ::Integer) -> ::Integer
16
+ | (::int, ::int, ::Integer) -> ::Integer
17
+ | (::int, ::int, ::Array[::Integer]) -> ::Array[::Integer]
18
+ | (::int, ::int, nil) -> nil
19
+ | (::Range[::Integer], ::Integer) -> ::Integer
20
+ | (::Range[::Integer], ::Array[::Integer]) -> ::Array[::Integer]
21
+ | (::Range[::Integer], nil) -> nil
22
+ code: Ruby::UnresolvedOverloading
23
+ - range:
24
+ start:
25
+ line: 12
26
+ character: 0
27
+ end:
28
+ line: 12
29
+ character: 8
30
+ severity: ERROR
31
+ message: |-
32
+ Cannot assign a value of type `::Integer` to a variable of type `::String`
33
+ ::Integer <: ::String
34
+ ::Numeric <: ::String
35
+ ::Object <: ::String
36
+ ::BasicObject <: ::String
37
+ code: Ruby::IncompatibleAssignment
38
+ - range:
39
+ start:
40
+ line: 18
41
+ character: 0
42
+ end:
43
+ line: 18
44
+ character: 8
45
+ severity: ERROR
46
+ message: |-
47
+ Cannot assign a value of type `::String` to a variable of type `::Integer`
48
+ ::String <: ::Integer
49
+ ::Object <: ::Integer
50
+ ::BasicObject <: ::Integer
51
+ code: Ruby::IncompatibleAssignment
52
+ - file: b.rb
53
+ diagnostics:
54
+ - range:
55
+ start:
56
+ line: 11
57
+ character: 0
58
+ end:
59
+ line: 11
60
+ character: 5
61
+ severity: ERROR
62
+ message: |-
63
+ Cannot assign a value of type `::Array[::Integer]` to a variable of type `::Array[::String]`
64
+ ::Array[::Integer] <: ::Array[::String]
65
+ ::Integer <: ::String
66
+ ::Numeric <: ::String
67
+ ::Object <: ::String
68
+ ::BasicObject <: ::String
69
+ code: Ruby::IncompatibleAssignment
70
+ - range:
71
+ start:
72
+ line: 12
73
+ character: 0
74
+ end:
75
+ line: 12
76
+ character: 5
77
+ severity: ERROR
78
+ message: |-
79
+ Cannot assign a value of type `::Array[::String]` to a variable of type `::Array[::Integer]`
80
+ ::Array[::String] <: ::Array[::Integer]
81
+ ::String <: ::Integer
82
+ ::Object <: ::Integer
83
+ ::BasicObject <: ::Integer
84
+ code: Ruby::IncompatibleAssignment
85
+ - file: c.rb
86
+ diagnostics:
87
+ - range:
88
+ start:
89
+ line: 6
90
+ character: 0
91
+ end:
92
+ line: 6
93
+ character: 7
94
+ severity: ERROR
95
+ message: |-
96
+ Cannot assign a value of type `::Array[::Integer]` to a variable of type `::Array[(::String | nil)]`
97
+ ::Array[::Integer] <: ::Array[(::String | nil)]
98
+ ::Integer <: (::String | nil)
99
+ ::Integer <: ::String
100
+ ::Numeric <: ::String
101
+ ::Object <: ::String
102
+ ::BasicObject <: ::String
103
+ code: Ruby::IncompatibleAssignment