steep 0.37.0 → 0.42.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/CHANGELOG.md +34 -0
  4. data/Rakefile +5 -2
  5. data/bin/output_rebaseline.rb +34 -0
  6. data/bin/output_test.rb +53 -0
  7. data/lib/steep.rb +95 -14
  8. data/lib/steep/ast/types/bot.rb +1 -1
  9. data/lib/steep/ast/types/class.rb +4 -0
  10. data/lib/steep/ast/types/factory.rb +10 -0
  11. data/lib/steep/ast/types/logic.rb +16 -3
  12. data/lib/steep/ast/types/top.rb +1 -1
  13. data/lib/steep/cli.rb +31 -7
  14. data/lib/steep/diagnostic/helper.rb +17 -0
  15. data/lib/steep/diagnostic/lsp_formatter.rb +16 -0
  16. data/lib/steep/diagnostic/ruby.rb +619 -0
  17. data/lib/steep/diagnostic/signature.rb +357 -0
  18. data/lib/steep/drivers/annotations.rb +19 -28
  19. data/lib/steep/drivers/check.rb +182 -60
  20. data/lib/steep/drivers/diagnostic_printer.rb +99 -0
  21. data/lib/steep/drivers/langserver.rb +3 -8
  22. data/lib/steep/drivers/print_project.rb +10 -9
  23. data/lib/steep/drivers/stats.rb +124 -32
  24. data/lib/steep/drivers/trace_printer.rb +5 -1
  25. data/lib/steep/drivers/utils/jobs_count.rb +9 -0
  26. data/lib/steep/drivers/validate.rb +31 -13
  27. data/lib/steep/drivers/watch.rb +69 -48
  28. data/lib/steep/drivers/worker.rb +16 -8
  29. data/lib/steep/expectations.rb +159 -0
  30. data/lib/steep/index/rbs_index.rb +334 -0
  31. data/lib/steep/index/signature_symbol_provider.rb +162 -0
  32. data/lib/steep/index/source_index.rb +100 -0
  33. data/lib/steep/project.rb +0 -30
  34. data/lib/steep/project/dsl.rb +5 -3
  35. data/lib/steep/project/options.rb +4 -4
  36. data/lib/steep/project/pattern.rb +56 -0
  37. data/lib/steep/project/target.rb +9 -214
  38. data/lib/steep/range_extension.rb +29 -0
  39. data/lib/steep/server/base_worker.rb +43 -7
  40. data/lib/steep/server/change_buffer.rb +63 -0
  41. data/lib/steep/server/interaction_worker.rb +73 -56
  42. data/lib/steep/server/master.rb +245 -109
  43. data/lib/steep/server/type_check_worker.rb +122 -0
  44. data/lib/steep/server/worker_process.rb +17 -15
  45. data/lib/steep/{project → services}/completion_provider.rb +3 -3
  46. data/lib/steep/services/content_change.rb +61 -0
  47. data/lib/steep/services/file_loader.rb +48 -0
  48. data/lib/steep/{project → services}/hover_content.rb +14 -16
  49. data/lib/steep/services/path_assignment.rb +29 -0
  50. data/lib/steep/services/signature_service.rb +369 -0
  51. data/lib/steep/services/stats_calculator.rb +69 -0
  52. data/lib/steep/services/type_check_service.rb +342 -0
  53. data/lib/steep/signature/validator.rb +174 -32
  54. data/lib/steep/subtyping/check.rb +248 -47
  55. data/lib/steep/subtyping/constraints.rb +2 -2
  56. data/lib/steep/type_construction.rb +565 -295
  57. data/lib/steep/type_inference/constant_env.rb +5 -1
  58. data/lib/steep/type_inference/local_variable_type_env.rb +26 -12
  59. data/lib/steep/type_inference/logic_type_interpreter.rb +99 -26
  60. data/lib/steep/type_inference/type_env.rb +43 -17
  61. data/lib/steep/typing.rb +8 -2
  62. data/lib/steep/version.rb +1 -1
  63. data/smoke/alias/a.rb +0 -3
  64. data/smoke/alias/b.rb +0 -1
  65. data/smoke/alias/c.rb +0 -2
  66. data/smoke/alias/test_expectations.yml +96 -0
  67. data/smoke/and/a.rb +0 -3
  68. data/smoke/and/test_expectations.yml +31 -0
  69. data/smoke/array/a.rb +0 -3
  70. data/smoke/array/b.rb +0 -2
  71. data/smoke/array/c.rb +0 -1
  72. data/smoke/array/test_expectations.yml +103 -0
  73. data/smoke/block/a.rb +0 -2
  74. data/smoke/block/b.rb +0 -2
  75. data/smoke/block/d.rb +0 -4
  76. data/smoke/block/test_expectations.yml +125 -0
  77. data/smoke/case/a.rb +0 -3
  78. data/smoke/case/test_expectations.yml +47 -0
  79. data/smoke/class/a.rb +0 -3
  80. data/smoke/class/c.rb +0 -1
  81. data/smoke/class/f.rb +0 -1
  82. data/smoke/class/g.rb +0 -2
  83. data/smoke/class/i.rb +0 -2
  84. data/smoke/class/test_expectations.yml +120 -0
  85. data/smoke/const/a.rb +0 -3
  86. data/smoke/const/b.rb +7 -0
  87. data/smoke/const/b.rbs +5 -0
  88. data/smoke/const/test_expectations.yml +139 -0
  89. data/smoke/diagnostics-rbs-duplicated/Steepfile +5 -0
  90. data/smoke/diagnostics-rbs-duplicated/a.rbs +5 -0
  91. data/smoke/diagnostics-rbs-duplicated/test_expectations.yml +13 -0
  92. data/smoke/diagnostics-rbs/Steepfile +8 -0
  93. data/smoke/diagnostics-rbs/duplicated-method-definition.rbs +20 -0
  94. data/smoke/diagnostics-rbs/generic-parameter-mismatch.rbs +7 -0
  95. data/smoke/diagnostics-rbs/invalid-method-overload.rbs +3 -0
  96. data/smoke/diagnostics-rbs/invalid-type-application.rbs +7 -0
  97. data/smoke/diagnostics-rbs/invalid_variance_annotation.rbs +3 -0
  98. data/smoke/diagnostics-rbs/recursive-alias.rbs +5 -0
  99. data/smoke/diagnostics-rbs/recursive-class.rbs +8 -0
  100. data/smoke/diagnostics-rbs/superclass-mismatch.rbs +7 -0
  101. data/smoke/diagnostics-rbs/test_expectations.yml +231 -0
  102. data/smoke/diagnostics-rbs/unknown-method-alias.rbs +3 -0
  103. data/smoke/diagnostics-rbs/unknown-type-name-2.rbs +5 -0
  104. data/smoke/diagnostics-rbs/unknown-type-name.rbs +13 -0
  105. data/smoke/diagnostics/Steepfile +5 -0
  106. data/smoke/diagnostics/a.rbs +26 -0
  107. data/smoke/diagnostics/argument_type_mismatch.rb +1 -0
  108. data/smoke/diagnostics/block_body_type_mismatch.rb +1 -0
  109. data/smoke/diagnostics/block_type_mismatch.rb +3 -0
  110. data/smoke/diagnostics/break_type_mismatch.rb +1 -0
  111. data/smoke/diagnostics/else_on_exhaustive_case.rb +12 -0
  112. data/smoke/diagnostics/incompatible_annotation.rb +6 -0
  113. data/smoke/diagnostics/incompatible_argument.rb +1 -0
  114. data/smoke/diagnostics/incompatible_assignment.rb +8 -0
  115. data/smoke/diagnostics/method_arity_mismatch.rb +11 -0
  116. data/smoke/diagnostics/method_body_type_mismatch.rb +6 -0
  117. data/smoke/diagnostics/method_definition_missing.rb +2 -0
  118. data/smoke/diagnostics/method_return_type_annotation_mismatch.rb +7 -0
  119. data/smoke/diagnostics/missing_keyword.rb +1 -0
  120. data/smoke/diagnostics/no_method.rb +1 -0
  121. data/smoke/diagnostics/required_block_missing.rb +1 -0
  122. data/smoke/diagnostics/return_type_mismatch.rb +6 -0
  123. data/smoke/diagnostics/test_expectations.yml +477 -0
  124. data/smoke/diagnostics/unexpected_block_given.rb +1 -0
  125. data/smoke/diagnostics/unexpected_dynamic_method.rb +3 -0
  126. data/smoke/diagnostics/unexpected_jump.rb +4 -0
  127. data/smoke/diagnostics/unexpected_jump_value.rb +3 -0
  128. data/smoke/diagnostics/unexpected_keyword.rb +1 -0
  129. data/smoke/diagnostics/unexpected_splat.rb +1 -0
  130. data/smoke/diagnostics/unexpected_yield.rb +6 -0
  131. data/smoke/diagnostics/unknown_constant_assigned.rb +7 -0
  132. data/smoke/diagnostics/unresolved_overloading.rb +1 -0
  133. data/smoke/diagnostics/unsatisfiable_constraint.rb +7 -0
  134. data/smoke/diagnostics/unsupported_syntax.rb +2 -0
  135. data/smoke/dstr/a.rb +0 -1
  136. data/smoke/dstr/test_expectations.yml +13 -0
  137. data/smoke/ensure/a.rb +0 -4
  138. data/smoke/ensure/test_expectations.yml +62 -0
  139. data/smoke/enumerator/a.rb +0 -6
  140. data/smoke/enumerator/b.rb +0 -3
  141. data/smoke/enumerator/test_expectations.yml +135 -0
  142. data/smoke/extension/a.rb +0 -1
  143. data/smoke/extension/b.rb +0 -2
  144. data/smoke/extension/c.rb +0 -1
  145. data/smoke/extension/f.rb +2 -0
  146. data/smoke/extension/f.rbs +3 -0
  147. data/smoke/extension/test_expectations.yml +73 -0
  148. data/smoke/hash/b.rb +0 -1
  149. data/smoke/hash/c.rb +0 -3
  150. data/smoke/hash/d.rb +0 -1
  151. data/smoke/hash/e.rb +0 -1
  152. data/smoke/hash/test_expectations.yml +81 -0
  153. data/smoke/hello/hello.rb +0 -2
  154. data/smoke/hello/test_expectations.yml +25 -0
  155. data/smoke/if/a.rb +0 -2
  156. data/smoke/if/test_expectations.yml +34 -0
  157. data/smoke/implements/a.rb +0 -2
  158. data/smoke/implements/test_expectations.yml +23 -0
  159. data/smoke/initialize/test_expectations.yml +1 -0
  160. data/smoke/integer/a.rb +0 -7
  161. data/smoke/integer/test_expectations.yml +101 -0
  162. data/smoke/interface/a.rb +0 -2
  163. data/smoke/interface/test_expectations.yml +23 -0
  164. data/smoke/kwbegin/a.rb +0 -1
  165. data/smoke/kwbegin/test_expectations.yml +17 -0
  166. data/smoke/lambda/a.rb +1 -4
  167. data/smoke/lambda/test_expectations.yml +39 -0
  168. data/smoke/literal/a.rb +0 -5
  169. data/smoke/literal/b.rb +0 -2
  170. data/smoke/literal/test_expectations.yml +106 -0
  171. data/smoke/map/test_expectations.yml +1 -0
  172. data/smoke/method/a.rb +0 -5
  173. data/smoke/method/b.rb +0 -1
  174. data/smoke/method/test_expectations.yml +90 -0
  175. data/smoke/module/a.rb +0 -2
  176. data/smoke/module/b.rb +0 -2
  177. data/smoke/module/c.rb +0 -1
  178. data/smoke/module/d.rb +0 -1
  179. data/smoke/module/f.rb +0 -2
  180. data/smoke/module/test_expectations.yml +75 -0
  181. data/smoke/regexp/a.rb +0 -38
  182. data/smoke/regexp/b.rb +0 -26
  183. data/smoke/regexp/test_expectations.yml +615 -0
  184. data/smoke/regression/set_divide.rb +0 -4
  185. data/smoke/regression/test_expectations.yml +43 -0
  186. data/smoke/rescue/a.rb +0 -5
  187. data/smoke/rescue/test_expectations.yml +79 -0
  188. data/smoke/self/a.rb +0 -2
  189. data/smoke/self/test_expectations.yml +23 -0
  190. data/smoke/skip/skip.rb +0 -2
  191. data/smoke/skip/test_expectations.yml +23 -0
  192. data/smoke/stdout/test_expectations.yml +1 -0
  193. data/smoke/super/a.rb +0 -4
  194. data/smoke/super/test_expectations.yml +79 -0
  195. data/smoke/toplevel/a.rb +0 -1
  196. data/smoke/toplevel/test_expectations.yml +15 -0
  197. data/smoke/tsort/Steepfile +2 -0
  198. data/smoke/tsort/a.rb +0 -3
  199. data/smoke/tsort/test_expectations.yml +63 -0
  200. data/smoke/type_case/a.rb +0 -4
  201. data/smoke/type_case/test_expectations.yml +48 -0
  202. data/smoke/unexpected/Steepfile +5 -0
  203. data/smoke/unexpected/test_expectations.yml +25 -0
  204. data/smoke/unexpected/unexpected.rb +1 -0
  205. data/smoke/unexpected/unexpected.rbs +3 -0
  206. data/smoke/yield/a.rb +0 -3
  207. data/smoke/yield/b.rb +6 -0
  208. data/smoke/yield/test_expectations.yml +68 -0
  209. data/steep.gemspec +4 -3
  210. metadata +144 -29
  211. data/bin/smoke_runner.rb +0 -139
  212. data/lib/steep/drivers/signature_error_printer.rb +0 -25
  213. data/lib/steep/errors.rb +0 -565
  214. data/lib/steep/project/file_loader.rb +0 -68
  215. data/lib/steep/project/signature_file.rb +0 -33
  216. data/lib/steep/project/source_file.rb +0 -129
  217. data/lib/steep/server/code_worker.rb +0 -137
  218. data/lib/steep/server/signature_worker.rb +0 -152
  219. data/lib/steep/server/utils.rb +0 -69
  220. data/lib/steep/signature/errors.rb +0 -82
  221. data/lib/steep/type_assignability.rb +0 -367
data/smoke/hash/b.rb CHANGED
@@ -3,5 +3,4 @@
3
3
  x = { foo: "foo" }
4
4
  x = { foo: nil }
5
5
 
6
- # !expects IncompatibleAssignment: lhs_type=::Hash[::Symbol, (::String | nil)], rhs_type=::Hash[::Symbol, ::Integer]
7
6
  x = { foo: 3 }
data/smoke/hash/c.rb CHANGED
@@ -2,14 +2,11 @@
2
2
  params = _ = nil
3
3
 
4
4
  id = params[:id]
5
- # !expects NoMethodError: type=::Integer, method=abcdefg
6
5
  id.abcdefg
7
6
 
8
7
  name = params[:name]
9
- # !expects NoMethodError: type=::String, method=abcdefg
10
8
  name.abcdefg
11
9
 
12
- # !expects NoMethodError: type=(::Integer | ::String), method=abcdefg
13
10
  params[(_=nil) ? :id : :name].abcdefg
14
11
 
15
12
  # @type var controller: Controller
data/smoke/hash/d.rb CHANGED
@@ -2,5 +2,4 @@
2
2
 
3
3
  params = { id: 30, name: "Matz" }
4
4
 
5
- # !expects IncompatibleAssignment: lhs_type={ :id => ::Integer, :name => ::String }, rhs_type={ :email => ::String, :id => ::String, :name => ::String }
6
5
  params = { id: "30", name: "foo", email: "matsumoto@soutaro.com" }
data/smoke/hash/e.rb CHANGED
@@ -1,2 +1 @@
1
- # !expects NoMethodError: type=::Integer, method=fffffffffffff
2
1
  Foo.new.get({ foo: 3 }).fffffffffffff
@@ -0,0 +1,81 @@
1
+ ---
2
+ - file: b.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 6
7
+ character: 0
8
+ end:
9
+ line: 6
10
+ character: 14
11
+ severity: ERROR
12
+ message: |-
13
+ Cannot assign a value of type `::Hash[::Symbol, ::Integer]` to a variable of type `::Hash[::Symbol, (::String | nil)]`
14
+ ::Hash[::Symbol, ::Integer] <: ::Hash[::Symbol, (::String | nil)]
15
+ ::Integer <: (::String | nil)
16
+ ::Integer <: ::String
17
+ ::Numeric <: ::String
18
+ ::Object <: ::String
19
+ ::BasicObject <: ::String
20
+ code: Ruby::IncompatibleAssignment
21
+ - file: c.rb
22
+ diagnostics:
23
+ - range:
24
+ start:
25
+ line: 5
26
+ character: 3
27
+ end:
28
+ line: 5
29
+ character: 10
30
+ severity: ERROR
31
+ message: Type `::Integer` does not have method `abcdefg`
32
+ code: Ruby::NoMethod
33
+ - range:
34
+ start:
35
+ line: 8
36
+ character: 5
37
+ end:
38
+ line: 8
39
+ character: 12
40
+ severity: ERROR
41
+ message: Type `::String` does not have method `abcdefg`
42
+ code: Ruby::NoMethod
43
+ - range:
44
+ start:
45
+ line: 10
46
+ character: 30
47
+ end:
48
+ line: 10
49
+ character: 37
50
+ severity: ERROR
51
+ message: Type `(::Integer | ::String)` does not have method `abcdefg`
52
+ code: Ruby::NoMethod
53
+ - file: d.rb
54
+ diagnostics:
55
+ - range:
56
+ start:
57
+ line: 5
58
+ character: 0
59
+ end:
60
+ line: 5
61
+ character: 66
62
+ severity: ERROR
63
+ message: |-
64
+ Cannot assign a value of type `{ :email => ::String, :id => ::String, :name => ::String }` to a variable of type `{ :id => ::Integer, :name => ::String }`
65
+ { :email => ::String, :id => ::String, :name => ::String } <: { :id => ::Integer, :name => ::String }
66
+ ::String <: ::Integer
67
+ ::Object <: ::Integer
68
+ ::BasicObject <: ::Integer
69
+ code: Ruby::IncompatibleAssignment
70
+ - file: e.rb
71
+ diagnostics:
72
+ - range:
73
+ start:
74
+ line: 1
75
+ character: 24
76
+ end:
77
+ line: 1
78
+ character: 37
79
+ severity: ERROR
80
+ message: Type `::Integer` does not have method `fffffffffffff`
81
+ code: Ruby::NoMethod
data/smoke/hello/hello.rb CHANGED
@@ -6,8 +6,6 @@ y = (_ = nil)
6
6
 
7
7
  a = x.foo
8
8
 
9
- # !expects NoMethodError: type=::_Bar, method=foo
10
9
  b = y.foo
11
10
 
12
- # !expects IncompatibleAssignment: lhs_type=::_Foo, rhs_type=::_Bar
13
11
  x = y
@@ -0,0 +1,25 @@
1
+ ---
2
+ - file: hello.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 9
7
+ character: 6
8
+ end:
9
+ line: 9
10
+ character: 9
11
+ severity: ERROR
12
+ message: Type `::_Bar` does not have method `foo`
13
+ code: Ruby::NoMethod
14
+ - range:
15
+ start:
16
+ line: 11
17
+ character: 0
18
+ end:
19
+ line: 11
20
+ character: 5
21
+ severity: ERROR
22
+ message: |-
23
+ Cannot assign a value of type `::_Bar` to a variable of type `::_Foo`
24
+ ::_Bar <: ::_Foo
25
+ code: Ruby::IncompatibleAssignment
data/smoke/if/a.rb CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  x = y = z = (_ = nil)
4
4
 
5
- # !expects IncompatibleAssignment: lhs_type=::String, rhs_type=(::Symbol | nil)
6
5
  a = if x
7
6
  :foo
8
7
  end
@@ -13,7 +12,6 @@ else
13
12
  "baz"
14
13
  end
15
14
 
16
- # !expects IncompatibleAssignment: lhs_type=::String, rhs_type=(::String | ::Integer)
17
15
  a = if z
18
16
  "foofoo"
19
17
  else
@@ -0,0 +1,34 @@
1
+ ---
2
+ - file: a.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 5
7
+ character: 0
8
+ end:
9
+ line: 7
10
+ character: 7
11
+ severity: ERROR
12
+ message: |-
13
+ Cannot assign a value of type `(::Symbol | nil)` to a variable of type `::String`
14
+ (::Symbol | nil) <: ::String
15
+ ::Symbol <: ::String
16
+ ::Object <: ::String
17
+ ::BasicObject <: ::String
18
+ code: Ruby::IncompatibleAssignment
19
+ - range:
20
+ start:
21
+ line: 15
22
+ character: 0
23
+ end:
24
+ line: 19
25
+ character: 7
26
+ severity: ERROR
27
+ message: |-
28
+ Cannot assign a value of type `(::String | ::Integer)` to a variable of type `::String`
29
+ (::String | ::Integer) <: ::String
30
+ ::Integer <: ::String
31
+ ::Numeric <: ::String
32
+ ::Object <: ::String
33
+ ::BasicObject <: ::String
34
+ code: Ruby::IncompatibleAssignment
@@ -1,5 +1,3 @@
1
- # !expects@+2 MethodDefinitionMissing: module=::A, method=baz
2
- # !expects MethodDefinitionMissing: module=::A, method=self.bar
3
1
  class A
4
2
  # @implements A
5
3
 
@@ -0,0 +1,23 @@
1
+ ---
2
+ - file: a.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 1
7
+ character: 6
8
+ end:
9
+ line: 1
10
+ character: 7
11
+ severity: ERROR
12
+ message: Cannot find implementation of method `::A#baz`
13
+ code: Ruby::MethodDefinitionMissing
14
+ - range:
15
+ start:
16
+ line: 1
17
+ character: 6
18
+ end:
19
+ line: 1
20
+ character: 7
21
+ severity: ERROR
22
+ message: Cannot find implementation of method `::A.bar`
23
+ code: Ruby::MethodDefinitionMissing
@@ -0,0 +1 @@
1
+ --- []
data/smoke/integer/a.rb CHANGED
@@ -1,33 +1,26 @@
1
1
  # @type var x: Numeric
2
2
  x = _ = 1
3
3
  integer_1 = Integer(x)
4
- # !expects NoMethodError: type=::Integer, method=foo
5
4
  integer_1.foo
6
5
 
7
6
  integer_2 = Integer("1")
8
- # !expects NoMethodError: type=::Integer, method=foo
9
7
  integer_2.foo
10
8
 
11
9
  class WithToInt
12
10
  def to_int; 1; end
13
11
  end
14
12
  integer_3 = Integer(WithToInt.new)
15
- # !expects NoMethodError: type=::Integer, method=foo
16
13
  integer_3.foo
17
14
 
18
15
  class WithToI
19
16
  def to_i; 1; end
20
17
  end
21
18
  integer_4 = Integer(WithToI.new)
22
- # !expects NoMethodError: type=::Integer, method=foo
23
19
  integer_4.foo
24
20
 
25
21
  integer_5 = Integer("10", 2)
26
- # !expects NoMethodError: type=::Integer, method=foo
27
22
  integer_5.foo
28
23
 
29
- # !expects* UnresolvedOverloading: receiver=::Object, method_name=Integer,
30
24
  Integer(Object.new)
31
25
 
32
- # !expects* UnresolvedOverloading: receiver=::Object, method_name=Integer,
33
26
  Integer(nil)
@@ -0,0 +1,101 @@
1
+ ---
2
+ - file: a.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 4
7
+ character: 10
8
+ end:
9
+ line: 4
10
+ character: 13
11
+ severity: ERROR
12
+ message: Type `::Integer` does not have method `foo`
13
+ code: Ruby::NoMethod
14
+ - range:
15
+ start:
16
+ line: 7
17
+ character: 10
18
+ end:
19
+ line: 7
20
+ character: 13
21
+ severity: ERROR
22
+ message: Type `::Integer` does not have method `foo`
23
+ code: Ruby::NoMethod
24
+ - range:
25
+ start:
26
+ line: 12
27
+ character: 20
28
+ end:
29
+ line: 12
30
+ character: 29
31
+ severity: ERROR
32
+ message: Cannot detect the type of the expression
33
+ code: Ruby::FallbackAny
34
+ - range:
35
+ start:
36
+ line: 13
37
+ character: 10
38
+ end:
39
+ line: 13
40
+ character: 13
41
+ severity: ERROR
42
+ message: Type `::Integer` does not have method `foo`
43
+ code: Ruby::NoMethod
44
+ - range:
45
+ start:
46
+ line: 18
47
+ character: 20
48
+ end:
49
+ line: 18
50
+ character: 27
51
+ severity: ERROR
52
+ message: Cannot detect the type of the expression
53
+ code: Ruby::FallbackAny
54
+ - range:
55
+ start:
56
+ line: 19
57
+ character: 10
58
+ end:
59
+ line: 19
60
+ character: 13
61
+ severity: ERROR
62
+ message: Type `::Integer` does not have method `foo`
63
+ code: Ruby::NoMethod
64
+ - range:
65
+ start:
66
+ line: 22
67
+ character: 10
68
+ end:
69
+ line: 22
70
+ character: 13
71
+ severity: ERROR
72
+ message: Type `::Integer` does not have method `foo`
73
+ code: Ruby::NoMethod
74
+ - range:
75
+ start:
76
+ line: 24
77
+ character: 0
78
+ end:
79
+ line: 24
80
+ character: 19
81
+ severity: ERROR
82
+ message: |-
83
+ Cannot find compatible overloading of method `Integer` of type `::Object`
84
+ Method types:
85
+ def Integer: ((::Numeric | ::String), ?exception: bool) -> ::Integer
86
+ | (::String, ?::Integer, ?exception: bool) -> ::Integer
87
+ code: Ruby::UnresolvedOverloading
88
+ - range:
89
+ start:
90
+ line: 26
91
+ character: 0
92
+ end:
93
+ line: 26
94
+ character: 12
95
+ severity: ERROR
96
+ message: |-
97
+ Cannot find compatible overloading of method `Integer` of type `::Object`
98
+ Method types:
99
+ def Integer: ((::Numeric | ::String), ?exception: bool) -> ::Integer
100
+ | (::String, ?::Integer, ?exception: bool) -> ::Integer
101
+ code: Ruby::UnresolvedOverloading
data/smoke/interface/a.rb CHANGED
@@ -2,13 +2,11 @@ class A
2
2
  # @dynamic foo
3
3
 
4
4
  def hello
5
- # !expects NoMethodError: type=::A::Object, method=bar
6
5
  foo.foo.bar
7
6
 
8
7
  # @type var object: ::Object
9
8
  object = _ = nil
10
9
 
11
- # !expects NoMethodError: type=::Object, method=object?
12
10
  object.object?
13
11
  end
14
12
  end
@@ -0,0 +1,23 @@
1
+ ---
2
+ - file: a.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 5
7
+ character: 12
8
+ end:
9
+ line: 5
10
+ character: 15
11
+ severity: ERROR
12
+ message: Type `::A::Object` does not have method `bar`
13
+ code: Ruby::NoMethod
14
+ - range:
15
+ start:
16
+ line: 10
17
+ character: 11
18
+ end:
19
+ line: 10
20
+ character: 18
21
+ severity: ERROR
22
+ message: Type `::Object` does not have method `object?`
23
+ code: Ruby::NoMethod
data/smoke/kwbegin/a.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # @type var a: Integer
2
2
 
3
- # !expects IncompatibleAssignment: lhs_type=::Integer, rhs_type=::String
4
3
  a = begin
5
4
  # @type var x: String
6
5
  x = '1'
@@ -0,0 +1,17 @@
1
+ ---
2
+ - file: a.rb
3
+ diagnostics:
4
+ - range:
5
+ start:
6
+ line: 3
7
+ character: 0
8
+ end:
9
+ line: 7
10
+ character: 3
11
+ severity: ERROR
12
+ message: |-
13
+ Cannot assign a value of type `::String` to a variable of type `::Integer`
14
+ ::String <: ::Integer
15
+ ::Object <: ::Integer
16
+ ::BasicObject <: ::Integer
17
+ code: Ruby::IncompatibleAssignment