steep 0.39.0 → 0.40.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 (183) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/CHANGELOG.md +6 -0
  4. data/Rakefile +5 -2
  5. data/bin/output_rebaseline.rb +49 -0
  6. data/bin/output_test.rb +93 -0
  7. data/lib/steep.rb +8 -3
  8. data/lib/steep/cli.rb +1 -1
  9. data/lib/steep/diagnostic/helper.rb +17 -0
  10. data/lib/steep/diagnostic/lsp_formatter.rb +16 -0
  11. data/lib/steep/diagnostic/ruby.rb +623 -0
  12. data/lib/steep/diagnostic/signature.rb +224 -0
  13. data/lib/steep/drivers/annotations.rb +13 -6
  14. data/lib/steep/drivers/check.rb +83 -60
  15. data/lib/steep/drivers/diagnostic_printer.rb +94 -0
  16. data/lib/steep/drivers/stats.rb +125 -29
  17. data/lib/steep/drivers/trace_printer.rb +5 -1
  18. data/lib/steep/drivers/validate.rb +13 -6
  19. data/lib/steep/drivers/watch.rb +26 -9
  20. data/lib/steep/drivers/worker.rb +5 -0
  21. data/lib/steep/project/options.rb +4 -4
  22. data/lib/steep/project/signature_file.rb +8 -2
  23. data/lib/steep/project/stats_calculator.rb +80 -0
  24. data/lib/steep/project/target.rb +64 -53
  25. data/lib/steep/range_extension.rb +29 -0
  26. data/lib/steep/server/base_worker.rb +42 -4
  27. data/lib/steep/server/code_worker.rb +37 -24
  28. data/lib/steep/server/interaction_worker.rb +1 -0
  29. data/lib/steep/server/master.rb +268 -82
  30. data/lib/steep/server/signature_worker.rb +7 -59
  31. data/lib/steep/server/worker_process.rb +9 -9
  32. data/lib/steep/signature/validator.rb +33 -9
  33. data/lib/steep/type_construction.rb +276 -194
  34. data/lib/steep/version.rb +1 -1
  35. data/smoke/alias/a.rb +0 -3
  36. data/smoke/alias/b.rb +0 -1
  37. data/smoke/alias/c.rb +0 -2
  38. data/smoke/alias/test.yaml +73 -0
  39. data/smoke/and/a.rb +0 -3
  40. data/smoke/and/test.yaml +24 -0
  41. data/smoke/array/a.rb +0 -3
  42. data/smoke/array/b.rb +0 -2
  43. data/smoke/array/c.rb +0 -1
  44. data/smoke/array/test.yaml +80 -0
  45. data/smoke/block/a.rb +0 -2
  46. data/smoke/block/b.rb +0 -2
  47. data/smoke/block/d.rb +0 -4
  48. data/smoke/block/test.yaml +96 -0
  49. data/smoke/broken/Steepfile +5 -0
  50. data/smoke/broken/broken.rb +0 -0
  51. data/smoke/broken/broken.rbs +0 -0
  52. data/smoke/broken/test.yaml +6 -0
  53. data/smoke/case/a.rb +0 -3
  54. data/smoke/case/test.yaml +36 -0
  55. data/smoke/class/a.rb +0 -3
  56. data/smoke/class/c.rb +0 -1
  57. data/smoke/class/f.rb +0 -1
  58. data/smoke/class/g.rb +0 -2
  59. data/smoke/class/i.rb +0 -2
  60. data/smoke/class/test.yaml +89 -0
  61. data/smoke/const/a.rb +0 -3
  62. data/smoke/const/b.rb +7 -0
  63. data/smoke/const/b.rbs +5 -0
  64. data/smoke/const/test.yaml +96 -0
  65. data/smoke/diagnostics-rbs-duplicated/Steepfile +5 -0
  66. data/smoke/diagnostics-rbs-duplicated/a.rbs +5 -0
  67. data/smoke/diagnostics-rbs-duplicated/test.yaml +10 -0
  68. data/smoke/diagnostics-rbs/Steepfile +5 -0
  69. data/smoke/diagnostics-rbs/duplicated-method-definition.rbs +20 -0
  70. data/smoke/diagnostics-rbs/generic-parameter-mismatch.rbs +7 -0
  71. data/smoke/diagnostics-rbs/invalid-method-overload.rbs +3 -0
  72. data/smoke/diagnostics-rbs/invalid-type-application.rbs +7 -0
  73. data/smoke/diagnostics-rbs/invalid_variance_annotation.rbs +3 -0
  74. data/smoke/diagnostics-rbs/recursive-alias.rbs +5 -0
  75. data/smoke/diagnostics-rbs/recursive-class.rbs +8 -0
  76. data/smoke/diagnostics-rbs/superclass-mismatch.rbs +7 -0
  77. data/smoke/diagnostics-rbs/test.yaml +142 -0
  78. data/smoke/diagnostics-rbs/unknown-method-alias.rbs +3 -0
  79. data/smoke/diagnostics-rbs/unknown-type-name.rbs +13 -0
  80. data/smoke/diagnostics/Steepfile +5 -0
  81. data/smoke/diagnostics/a.rbs +26 -0
  82. data/smoke/diagnostics/argument_type_mismatch.rb +1 -0
  83. data/smoke/diagnostics/block_body_type_mismatch.rb +1 -0
  84. data/smoke/diagnostics/block_type_mismatch.rb +3 -0
  85. data/smoke/diagnostics/break_type_mismatch.rb +1 -0
  86. data/smoke/diagnostics/else_on_exhaustive_case.rb +12 -0
  87. data/smoke/diagnostics/incompatible_annotation.rb +6 -0
  88. data/smoke/diagnostics/incompatible_argument.rb +1 -0
  89. data/smoke/diagnostics/incompatible_assignment.rb +8 -0
  90. data/smoke/diagnostics/method_arity_mismatch.rb +11 -0
  91. data/smoke/diagnostics/method_body_type_mismatch.rb +6 -0
  92. data/smoke/diagnostics/method_definition_missing.rb +2 -0
  93. data/smoke/diagnostics/method_return_type_annotation_mismatch.rb +7 -0
  94. data/smoke/diagnostics/missing_keyword.rb +1 -0
  95. data/smoke/diagnostics/no_method.rb +1 -0
  96. data/smoke/diagnostics/required_block_missing.rb +1 -0
  97. data/smoke/diagnostics/return_type_mismatch.rb +6 -0
  98. data/smoke/diagnostics/test.yaml +333 -0
  99. data/smoke/diagnostics/unexpected_block_given.rb +1 -0
  100. data/smoke/diagnostics/unexpected_dynamic_method.rb +3 -0
  101. data/smoke/diagnostics/unexpected_jump.rb +4 -0
  102. data/smoke/diagnostics/unexpected_jump_value.rb +3 -0
  103. data/smoke/diagnostics/unexpected_keyword.rb +1 -0
  104. data/smoke/diagnostics/unexpected_splat.rb +1 -0
  105. data/smoke/diagnostics/unexpected_yield.rb +6 -0
  106. data/smoke/diagnostics/unknown_constant_assigned.rb +7 -0
  107. data/smoke/diagnostics/unresolved_overloading.rb +1 -0
  108. data/smoke/diagnostics/unsatisfiable_constraint.rb +7 -0
  109. data/smoke/diagnostics/unsupported_syntax.rb +2 -0
  110. data/smoke/dstr/a.rb +0 -1
  111. data/smoke/dstr/test.yaml +10 -0
  112. data/smoke/ensure/a.rb +0 -4
  113. data/smoke/ensure/test.yaml +47 -0
  114. data/smoke/enumerator/a.rb +0 -6
  115. data/smoke/enumerator/b.rb +0 -3
  116. data/smoke/enumerator/test.yaml +100 -0
  117. data/smoke/extension/a.rb +0 -1
  118. data/smoke/extension/b.rb +0 -2
  119. data/smoke/extension/c.rb +0 -1
  120. data/smoke/extension/test.yaml +50 -0
  121. data/smoke/hash/b.rb +0 -1
  122. data/smoke/hash/c.rb +0 -3
  123. data/smoke/hash/d.rb +0 -1
  124. data/smoke/hash/e.rb +0 -1
  125. data/smoke/hash/test.yaml +62 -0
  126. data/smoke/hello/hello.rb +0 -2
  127. data/smoke/hello/test.yaml +18 -0
  128. data/smoke/if/a.rb +0 -2
  129. data/smoke/if/test.yaml +27 -0
  130. data/smoke/implements/a.rb +0 -2
  131. data/smoke/implements/test.yaml +16 -0
  132. data/smoke/initialize/test.yaml +4 -0
  133. data/smoke/integer/a.rb +0 -7
  134. data/smoke/integer/test.yaml +66 -0
  135. data/smoke/interface/a.rb +0 -2
  136. data/smoke/interface/test.yaml +16 -0
  137. data/smoke/kwbegin/a.rb +0 -1
  138. data/smoke/kwbegin/test.yaml +14 -0
  139. data/smoke/lambda/a.rb +1 -4
  140. data/smoke/lambda/test.yaml +28 -0
  141. data/smoke/literal/a.rb +0 -5
  142. data/smoke/literal/b.rb +0 -2
  143. data/smoke/literal/test.yaml +79 -0
  144. data/smoke/map/test.yaml +4 -0
  145. data/smoke/method/a.rb +0 -5
  146. data/smoke/method/b.rb +0 -1
  147. data/smoke/method/test.yaml +71 -0
  148. data/smoke/module/a.rb +0 -2
  149. data/smoke/module/b.rb +0 -2
  150. data/smoke/module/c.rb +0 -1
  151. data/smoke/module/d.rb +0 -1
  152. data/smoke/module/f.rb +0 -2
  153. data/smoke/module/test.yaml +51 -0
  154. data/smoke/regexp/a.rb +0 -38
  155. data/smoke/regexp/b.rb +0 -26
  156. data/smoke/regexp/test.yaml +372 -0
  157. data/smoke/regression/set_divide.rb +0 -4
  158. data/smoke/regression/test.yaml +38 -0
  159. data/smoke/rescue/a.rb +0 -5
  160. data/smoke/rescue/test.yaml +60 -0
  161. data/smoke/self/a.rb +0 -2
  162. data/smoke/self/test.yaml +16 -0
  163. data/smoke/skip/skip.rb +0 -2
  164. data/smoke/skip/test.yaml +16 -0
  165. data/smoke/stdout/test.yaml +4 -0
  166. data/smoke/super/a.rb +0 -4
  167. data/smoke/super/test.yaml +52 -0
  168. data/smoke/toplevel/a.rb +0 -1
  169. data/smoke/toplevel/test.yaml +12 -0
  170. data/smoke/tsort/a.rb +0 -3
  171. data/smoke/tsort/test.yaml +32 -0
  172. data/smoke/type_case/a.rb +0 -4
  173. data/smoke/type_case/test.yaml +33 -0
  174. data/smoke/yield/a.rb +0 -3
  175. data/smoke/yield/b.rb +6 -0
  176. data/smoke/yield/test.yaml +49 -0
  177. data/steep.gemspec +3 -3
  178. metadata +108 -17
  179. data/bin/smoke_runner.rb +0 -139
  180. data/lib/steep/drivers/signature_error_printer.rb +0 -25
  181. data/lib/steep/errors.rb +0 -594
  182. data/lib/steep/signature/errors.rb +0 -128
  183. data/lib/steep/type_assignability.rb +0 -367
@@ -1,7 +1,6 @@
1
1
  class A
2
2
  # @implements X
3
3
 
4
- # !expects MethodBodyTypeMismatch: method=foo, expected=(::Integer | ::String), actual=::Symbol
5
4
  def foo(x)
6
5
  :foobar
7
6
  end
@@ -0,0 +1,71 @@
1
+ ---
2
+ test:
3
+ a.rb:
4
+ diagnostics:
5
+ - |
6
+ a.rb:6:2: [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
+ └ z = x
15
+ ~~~~~
16
+ - |
17
+ a.rb:8:2: [error] Cannot assign a value of type `::Integer` to a variable of type `::String`
18
+ │ ::Integer <: ::String
19
+ │ ::Numeric <: ::String
20
+ │ ::Object <: ::String
21
+ │ ::BasicObject <: ::String
22
+
23
+ │ Diagnostic ID: Ruby::IncompatibleAssignment
24
+
25
+ └ z = y
26
+ ~~~~~
27
+ - |
28
+ a.rb:3:0: [error] Cannot allow method body have type `::Integer` because declared as type `::String`
29
+ │ ::Integer <: ::String
30
+ │ ::Numeric <: ::String
31
+ │ ::Object <: ::String
32
+ │ ::BasicObject <: ::String
33
+
34
+ │ Diagnostic ID: Ruby::MethodBodyTypeMismatch
35
+
36
+ └ def foo(x, y:)
37
+ ~~~~~~~~~~~~~~
38
+ - |
39
+ a.rb:15:7: [error] Method parameters are incompatible with declaration `(::Integer) -> ::String`
40
+ │ Diagnostic ID: Ruby::MethodArityMismatch
41
+
42
+ └ def bar(x, y)
43
+ ~~~~~~
44
+ - |
45
+ a.rb:18:2: [error] Cannot assign a value of type `::Integer` to a variable of type `::String`
46
+ │ ::Integer <: ::String
47
+ │ ::Numeric <: ::String
48
+ │ ::Object <: ::String
49
+ │ ::BasicObject <: ::String
50
+
51
+ │ Diagnostic ID: Ruby::IncompatibleAssignment
52
+
53
+ └ z = x
54
+ ~~~~~
55
+ b.rb:
56
+ diagnostics:
57
+ - |
58
+ b.rb:4:2: [error] Cannot allow method body have type `::Symbol` because declared as type `(::Integer | ::String)`
59
+ │ ::Symbol <: (::Integer | ::String)
60
+ │ ::Symbol <: ::Integer
61
+ │ ::Object <: ::Integer
62
+ │ ::BasicObject <: ::Integer
63
+
64
+ │ Diagnostic ID: Ruby::MethodBodyTypeMismatch
65
+
66
+ └ def foo(x)
67
+ ~~~~~~~~~~
68
+ c.rb:
69
+ diagnostics: []
70
+ d.rb:
71
+ diagnostics: []
@@ -10,10 +10,8 @@ module A
10
10
  end
11
11
 
12
12
  # @type var s: String
13
- # !expects IncompatibleAssignment: lhs_type=::String, rhs_type=::Integer
14
13
  s = n
15
14
 
16
- # !expects NoMethodError: type=(::Object & ::_Each2[::Integer, ::A] & ::A), method=foo
17
15
  foo()
18
16
 
19
17
  n
@@ -1,5 +1,3 @@
1
- # ALLOW FAILURE
2
-
3
1
  # @type var klass: Class
4
2
  # @type var mod: Module
5
3
 
@@ -18,6 +18,5 @@ module A
18
18
  # ok
19
19
  block_given?
20
20
 
21
- # !expects NoMethodError: type=singleton(::A), method=no_such_method_in_module
22
21
  no_such_method_in_module
23
22
  end
@@ -1,5 +1,4 @@
1
1
  # If there is a same name module definition, it automatically implements.
2
2
 
3
- # !expects MethodDefinitionMissing: module=::X, method=foo
4
3
  module X
5
4
  end
@@ -1,5 +1,3 @@
1
- # !expects@+2 MethodDefinitionMissing: module=::Palette, method=self.nestopia_palette
2
- # !expects@+1 UnexpectedDynamicMethod: module=::Palette, method=nestopia_palette
3
1
  module Palette
4
2
  module_function
5
3
 
@@ -0,0 +1,51 @@
1
+ ---
2
+ test:
3
+ a.rb:
4
+ diagnostics:
5
+ - |
6
+ a.rb:13:4: [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
+ └ s = n
15
+ ~~~~~
16
+ - |
17
+ a.rb:15:4: [error] Type `(::Object & ::_Each2[::Integer, ::A] & ::A)` does not have method `foo`
18
+ │ Diagnostic ID: Ruby::NoMethod
19
+
20
+ └ foo()
21
+ ~~~
22
+ c.rb:
23
+ diagnostics:
24
+ - |
25
+ c.rb:21:2: [error] Type `singleton(::A)` does not have method `no_such_method_in_module`
26
+ │ Diagnostic ID: Ruby::NoMethod
27
+
28
+ └ no_such_method_in_module
29
+ ~~~~~~~~~~~~~~~~~~~~~~~~
30
+ d.rb:
31
+ diagnostics:
32
+ - |
33
+ d.rb:3:7: [error] Cannot find implementation of method `::X#foo`
34
+ │ Diagnostic ID: Ruby::MethodDefinitionMissing
35
+
36
+ └ module X
37
+ ~
38
+ f.rb:
39
+ diagnostics:
40
+ - |
41
+ f.rb:1:7: [error] Cannot find implementation of method `::Palette.nestopia_palette`
42
+ │ Diagnostic ID: Ruby::MethodDefinitionMissing
43
+
44
+ └ module Palette
45
+ ~~~~~~~
46
+ - |
47
+ f.rb:1:7: [error] @dynamic annotation contains unknown method name `nestopia_palette`
48
+ │ Diagnostic ID: Ruby::UnexpectedDynamicMethod
49
+
50
+ └ module Palette
51
+ ~~~~~~~
@@ -1,147 +1,109 @@
1
- # ALLOW FAILURE
2
-
3
1
  new_1 = Regexp.new("a")
4
- # !expects NoMethodError: type=::Regexp, method=foo
5
2
  new_1.foo
6
3
 
7
4
  new_2 = Regexp.new("a", true)
8
- # !expects NoMethodError: type=::Regexp, method=foo
9
5
  new_2.foo
10
6
 
11
7
  new_3 = Regexp.new("a", Regexp::EXTENDED | Regexp::IGNORECASE)
12
- # !expects NoMethodError: type=::Regexp, method=foo
13
8
  new_3.foo
14
9
 
15
10
  new_4 = Regexp.new(/a/)
16
- # !expects NoMethodError: type=::Regexp, method=foo
17
11
  new_4.foo
18
12
 
19
13
  compile_1 = Regexp.compile("a")
20
- # !expects NoMethodError: type=::Regexp, method=foo
21
14
  compile_1.foo
22
15
 
23
16
  compile_2 = Regexp.compile("a", true)
24
- # !expects NoMethodError: type=::Regexp, method=foo
25
17
  compile_2.foo
26
18
 
27
19
  compile_3 = Regexp.compile("a", Regexp::EXTENDED | Regexp::IGNORECASE)
28
- # !expects NoMethodError: type=::Regexp, method=foo
29
20
  compile_3.foo
30
21
 
31
22
  compile_4 = Regexp.compile(/a/)
32
- # !expects NoMethodError: type=::Regexp, method=foo
33
23
  compile_4.foo
34
24
 
35
25
  escape_1 = Regexp.escape("a")
36
- # !expects NoMethodError: type=::String, method=foo
37
26
  escape_1.foo
38
27
 
39
28
  last_match_1 = Regexp.last_match
40
- # !expects NoMethodError: type=(::MatchData | nil), method=foo
41
29
  last_match_1.foo
42
30
 
43
31
  last_match_2 = Regexp.last_match(1)
44
- # !expects NoMethodError: type=(::String | nil), method=foo
45
32
  last_match_2.foo
46
33
 
47
34
  quote_1 = Regexp.quote("a")
48
- # !expects NoMethodError: type=::String, method=foo
49
35
  quote_1.foo
50
36
 
51
37
  try_convert_1 = Regexp.try_convert(Object.new)
52
- # !expects NoMethodError: type=(::Regexp | nil), method=foo
53
38
  try_convert_1.foo
54
39
 
55
40
  union_1 = Regexp.union
56
- # !expects NoMethodError: type=::Regexp, method=foo
57
41
  union_1.foo
58
42
 
59
43
  union_2 = Regexp.union("a")
60
- # !expects NoMethodError: type=::Regexp, method=foo
61
44
  union_2.foo
62
45
 
63
46
  union_3 = Regexp.union("a", "b")
64
- # !expects NoMethodError: type=::Regexp, method=foo
65
47
  union_3.foo
66
48
 
67
49
  union_4 = Regexp.union(["a", "b"])
68
- # !expects NoMethodError: type=::Regexp, method=foo
69
50
  union_4.foo
70
51
 
71
52
  union_5 = Regexp.union(/a/)
72
- # !expects NoMethodError: type=::Regexp, method=foo
73
53
  union_5.foo
74
54
 
75
55
  union_6 = Regexp.union(/a/, /b/)
76
- # !expects NoMethodError: type=::Regexp, method=foo
77
56
  union_6.foo
78
57
 
79
58
  union_7 = Regexp.union([/a/, /b/])
80
- # !expects NoMethodError: type=::Regexp, method=foo
81
59
  union_7.foo
82
60
 
83
61
  op_eqeqeq_1 = /a/ === "a"
84
- # !expects NoMethodError: type=bool, method=foo
85
62
  op_eqeqeq_1.foo
86
63
 
87
64
  op_match_1 = /a/ =~ "a"
88
- # !expects NoMethodError: type=::Integer, method=foo
89
65
  op_match_1.foo
90
66
 
91
67
  casefold_1 = /a/.casefold?
92
- # !expects NoMethodError: type=bool, method=foo
93
68
  casefold_1.foo
94
69
 
95
70
  encoding_1 = /a/.encoding
96
- # !expects NoMethodError: type=::Encoding, method=foo
97
71
  encoding_1.foo
98
72
 
99
73
  fixed_encoding_1 = /a/.fixed_encoding?
100
- # !expects NoMethodError: type=bool, method=foo
101
74
  fixed_encoding_1.foo
102
75
 
103
76
  match_1 = /a/.match("a")
104
- # !expects NoMethodError: type=(::MatchData | nil), method=foo
105
77
  match_1.foo
106
78
 
107
79
  match_2 = /a/.match("a", 0)
108
- # !expects NoMethodError: type=(::MatchData | nil), method=foo
109
80
  match_2.foo
110
81
 
111
82
  /a/.match("a") do |m|
112
- # !expects NoMethodError: type=::MatchData, method=foo
113
83
  m.foo
114
84
  end
115
85
 
116
86
  /a/.match("a", 0) do |m|
117
- # !expects NoMethodError: type=::MatchData, method=foo
118
87
  m.foo
119
88
  end
120
89
 
121
90
  match_q_1 = /a/.match?("a")
122
- # !expects NoMethodError: type=bool, method=foo
123
91
  match_q_1.foo
124
92
 
125
93
  match_q_2 = /a/.match?("a", 0)
126
- # !expects NoMethodError: type=bool, method=foo
127
94
  match_q_2.foo
128
95
 
129
96
  named_captures_1 = /(?<foo>.)/.named_captures
130
- # !expects NoMethodError: type=::Hash[::String, ::Array[::Integer]], method=foo
131
97
  named_captures_1.foo
132
98
 
133
99
  names_1 = /(?<foo>.)/.names
134
- # !expects NoMethodError: type=::Array[::String], method=foo
135
100
  names_1.foo
136
101
 
137
102
  options_1 = /a/ix.options
138
- # !expects NoMethodError: type=::Integer, method=foo
139
103
  options_1.foo
140
104
 
141
105
  source_1 = /a/ix.source
142
- # !expects NoMethodError: type=::String, method=foo
143
106
  source_1.foo
144
107
 
145
108
  op_unary_match_1 = ~ /a/
146
- # !expects NoMethodError: type=(::Integer | nil), method=foo
147
109
  op_unary_match_1.foo
@@ -1,105 +1,79 @@
1
1
  /(?<foo>a)/.match("a") do |match|
2
2
  match_ref_1 = match[0]
3
- # !expects NoMethodError: type=(::String | nil), method=foo
4
3
  match_ref_1.foo
5
4
 
6
5
  match_ref_2 = match["foo"]
7
- # !expects NoMethodError: type=(::String | nil), method=foo
8
6
  match_ref_2.foo
9
7
 
10
8
  match_ref_3 = match[:foo]
11
- # !expects NoMethodError: type=(::String | nil), method=foo
12
9
  match_ref_3.foo
13
10
 
14
11
  match_ref_4 = match[0, 1]
15
- # !expects NoMethodError: type=::Array[(::String | nil)], method=foo
16
12
  match_ref_4.foo
17
13
 
18
14
  match_ref_5 = match[0..1]
19
- # !expects NoMethodError: type=::Array[(::String | nil)], method=foo
20
15
  match_ref_5.foo
21
16
 
22
17
  begin_1 = match.begin(0)
23
- # !expects NoMethodError: type=(::Integer | nil), method=foo
24
18
  begin_1.foo
25
19
 
26
20
  begin_2 = match.begin("foo")
27
- # !expects NoMethodError: type=(::Integer | nil), method=foo
28
21
  begin_2.foo
29
22
 
30
23
  begin_3 = match.begin(:foo)
31
- # !expects NoMethodError: type=(::Integer | nil), method=foo
32
24
  begin_3.foo
33
25
 
34
26
  captures_1 = match.captures
35
- # !expects NoMethodError: type=::Array[(::String | nil)], method=foo
36
27
  captures_1.foo
37
28
 
38
29
  end_1 = match.end(0)
39
- # !expects NoMethodError: type=(::Integer | nil), method=foo
40
30
  end_1.foo
41
31
 
42
32
  end_2 = match.end("foo")
43
- # !expects NoMethodError: type=(::Integer | nil), method=foo
44
33
  end_2.foo
45
34
 
46
35
  end_3 = match.end(:foo)
47
- # !expects NoMethodError: type=(::Integer | nil), method=foo
48
36
  end_3.foo
49
37
 
50
38
  length_1 = match.length
51
- # !expects NoMethodError: type=::Integer, method=foo
52
39
  length_1.foo
53
40
 
54
41
  named_captures_1 = match.named_captures
55
- # !expects NoMethodError: type=::Hash[::String, (::String | nil)], method=foo
56
42
  named_captures_1.foo
57
43
 
58
44
  names_1 = match.names
59
- # !expects NoMethodError: type=::Array[::String], method=foo
60
45
  names_1.foo
61
46
 
62
47
  offset_1 = match.offset(0)
63
- # !expects NoMethodError: type=([::Integer, ::Integer] | [nil, nil]), method=foo
64
48
  offset_1.foo
65
49
 
66
50
  offset_2 = match.offset("foo")
67
- # !expects NoMethodError: type=([::Integer, ::Integer] | [nil, nil]), method=foo
68
51
  offset_2.foo
69
52
 
70
53
  offset_3 = match.offset(:foo)
71
- # !expects NoMethodError: type=([::Integer, ::Integer] | [nil, nil]), method=foo
72
54
  offset_3.foo
73
55
 
74
56
  post_match_1 = match.post_match
75
- # !expects NoMethodError: type=::String, method=foo
76
57
  post_match_1.foo
77
58
 
78
59
  pre_match_1 = match.pre_match
79
- # !expects NoMethodError: type=::String, method=foo
80
60
  pre_match_1.foo
81
61
 
82
62
  regexp_1 = match.regexp
83
- # !expects NoMethodError: type=::Regexp, method=foo
84
63
  regexp_1.foo
85
64
 
86
65
  size_1 = match.size
87
- # !expects NoMethodError: type=::Integer, method=foo
88
66
  size_1.foo
89
67
 
90
68
  string_1 = match.string
91
- # !expects NoMethodError: type=::String, method=foo
92
69
  string_1.foo
93
70
 
94
71
  to_a_1 = match.to_a
95
- # !expects NoMethodError: type=::Array[(::String | nil)], method=foo
96
72
  to_a_1.foo
97
73
 
98
74
  values_at_1 = match.values_at
99
- # !expects NoMethodError: type=::Array[(::String | nil)], method=foo
100
75
  values_at_1.foo
101
76
 
102
77
  values_at_2 = match.values_at(0, "foo", :foo)
103
- # !expects NoMethodError: type=::Array[(::String | nil)], method=foo
104
78
  values_at_2.foo
105
79
  end
@@ -0,0 +1,372 @@
1
+ ---
2
+ test:
3
+ a.rb:
4
+ diagnostics:
5
+ - |
6
+ a.rb:2:6: [error] Type `::Regexp` does not have method `foo`
7
+ │ Diagnostic ID: Ruby::NoMethod
8
+
9
+ └ new_1.foo
10
+ ~~~
11
+ - |
12
+ a.rb:5:6: [error] Type `::Regexp` does not have method `foo`
13
+ │ Diagnostic ID: Ruby::NoMethod
14
+
15
+ └ new_2.foo
16
+ ~~~
17
+ - |
18
+ a.rb:8:6: [error] Type `::Regexp` does not have method `foo`
19
+ │ Diagnostic ID: Ruby::NoMethod
20
+
21
+ └ new_3.foo
22
+ ~~~
23
+ - |
24
+ a.rb:11:6: [error] Type `::Regexp` does not have method `foo`
25
+ │ Diagnostic ID: Ruby::NoMethod
26
+
27
+ └ new_4.foo
28
+ ~~~
29
+ - |
30
+ a.rb:14:10: [error] Type `::Regexp` does not have method `foo`
31
+ │ Diagnostic ID: Ruby::NoMethod
32
+
33
+ └ compile_1.foo
34
+ ~~~
35
+ - |
36
+ a.rb:17:10: [error] Type `::Regexp` does not have method `foo`
37
+ │ Diagnostic ID: Ruby::NoMethod
38
+
39
+ └ compile_2.foo
40
+ ~~~
41
+ - |
42
+ a.rb:20:10: [error] Type `::Regexp` does not have method `foo`
43
+ │ Diagnostic ID: Ruby::NoMethod
44
+
45
+ └ compile_3.foo
46
+ ~~~
47
+ - |
48
+ a.rb:23:10: [error] Type `::Regexp` does not have method `foo`
49
+ │ Diagnostic ID: Ruby::NoMethod
50
+
51
+ └ compile_4.foo
52
+ ~~~
53
+ - |
54
+ a.rb:26:9: [error] Type `::String` does not have method `foo`
55
+ │ Diagnostic ID: Ruby::NoMethod
56
+
57
+ └ escape_1.foo
58
+ ~~~
59
+ - |
60
+ a.rb:29:13: [error] Type `(::MatchData | nil)` does not have method `foo`
61
+ │ Diagnostic ID: Ruby::NoMethod
62
+
63
+ └ last_match_1.foo
64
+ ~~~
65
+ - |
66
+ a.rb:32:13: [error] Type `(::String | nil)` does not have method `foo`
67
+ │ Diagnostic ID: Ruby::NoMethod
68
+
69
+ └ last_match_2.foo
70
+ ~~~
71
+ - |
72
+ a.rb:35:8: [error] Type `::String` does not have method `foo`
73
+ │ Diagnostic ID: Ruby::NoMethod
74
+
75
+ └ quote_1.foo
76
+ ~~~
77
+ - |
78
+ a.rb:38:14: [error] Type `(::Regexp | nil)` does not have method `foo`
79
+ │ Diagnostic ID: Ruby::NoMethod
80
+
81
+ └ try_convert_1.foo
82
+ ~~~
83
+ - |
84
+ a.rb:41:8: [error] Type `::Regexp` does not have method `foo`
85
+ │ Diagnostic ID: Ruby::NoMethod
86
+
87
+ └ union_1.foo
88
+ ~~~
89
+ - |
90
+ a.rb:44:8: [error] Type `::Regexp` does not have method `foo`
91
+ │ Diagnostic ID: Ruby::NoMethod
92
+
93
+ └ union_2.foo
94
+ ~~~
95
+ - |
96
+ a.rb:47:8: [error] Type `::Regexp` does not have method `foo`
97
+ │ Diagnostic ID: Ruby::NoMethod
98
+
99
+ └ union_3.foo
100
+ ~~~
101
+ - |
102
+ a.rb:50:8: [error] Type `::Regexp` does not have method `foo`
103
+ │ Diagnostic ID: Ruby::NoMethod
104
+
105
+ └ union_4.foo
106
+ ~~~
107
+ - |
108
+ a.rb:53:8: [error] Type `::Regexp` does not have method `foo`
109
+ │ Diagnostic ID: Ruby::NoMethod
110
+
111
+ └ union_5.foo
112
+ ~~~
113
+ - |
114
+ a.rb:56:8: [error] Type `::Regexp` does not have method `foo`
115
+ │ Diagnostic ID: Ruby::NoMethod
116
+
117
+ └ union_6.foo
118
+ ~~~
119
+ - |
120
+ a.rb:59:8: [error] Type `::Regexp` does not have method `foo`
121
+ │ Diagnostic ID: Ruby::NoMethod
122
+
123
+ └ union_7.foo
124
+ ~~~
125
+ - |
126
+ a.rb:62:12: [error] Type `bool` does not have method `foo`
127
+ │ Diagnostic ID: Ruby::NoMethod
128
+
129
+ └ op_eqeqeq_1.foo
130
+ ~~~
131
+ - |
132
+ a.rb:68:11: [error] Type `bool` does not have method `foo`
133
+ │ Diagnostic ID: Ruby::NoMethod
134
+
135
+ └ casefold_1.foo
136
+ ~~~
137
+ - |
138
+ a.rb:71:11: [error] Type `::Encoding` does not have method `foo`
139
+ │ Diagnostic ID: Ruby::NoMethod
140
+
141
+ └ encoding_1.foo
142
+ ~~~
143
+ - |
144
+ a.rb:74:17: [error] Type `bool` does not have method `foo`
145
+ │ Diagnostic ID: Ruby::NoMethod
146
+
147
+ └ fixed_encoding_1.foo
148
+ ~~~
149
+ - |
150
+ a.rb:77:8: [error] Type `(::MatchData | nil)` does not have method `foo`
151
+ │ Diagnostic ID: Ruby::NoMethod
152
+
153
+ └ match_1.foo
154
+ ~~~
155
+ - |
156
+ a.rb:80:8: [error] Type `(::MatchData | nil)` does not have method `foo`
157
+ │ Diagnostic ID: Ruby::NoMethod
158
+
159
+ └ match_2.foo
160
+ ~~~
161
+ - |
162
+ a.rb:83:4: [error] Type `::MatchData` does not have method `foo`
163
+ │ Diagnostic ID: Ruby::NoMethod
164
+
165
+ └ m.foo
166
+ ~~~
167
+ - |
168
+ a.rb:87:4: [error] Type `::MatchData` does not have method `foo`
169
+ │ Diagnostic ID: Ruby::NoMethod
170
+
171
+ └ m.foo
172
+ ~~~
173
+ - |
174
+ a.rb:91:10: [error] Type `bool` does not have method `foo`
175
+ │ Diagnostic ID: Ruby::NoMethod
176
+
177
+ └ match_q_1.foo
178
+ ~~~
179
+ - |
180
+ a.rb:94:10: [error] Type `bool` does not have method `foo`
181
+ │ Diagnostic ID: Ruby::NoMethod
182
+
183
+ └ match_q_2.foo
184
+ ~~~
185
+ - |
186
+ a.rb:97:17: [error] Type `::Hash[::String, ::Array[::Integer]]` does not have method `foo`
187
+ │ Diagnostic ID: Ruby::NoMethod
188
+
189
+ └ named_captures_1.foo
190
+ ~~~
191
+ - |
192
+ a.rb:100:8: [error] Type `::Array[::String]` does not have method `foo`
193
+ │ Diagnostic ID: Ruby::NoMethod
194
+
195
+ └ names_1.foo
196
+ ~~~
197
+ - |
198
+ a.rb:103:10: [error] Type `::Integer` does not have method `foo`
199
+ │ Diagnostic ID: Ruby::NoMethod
200
+
201
+ └ options_1.foo
202
+ ~~~
203
+ - |
204
+ a.rb:106:9: [error] Type `::String` does not have method `foo`
205
+ │ Diagnostic ID: Ruby::NoMethod
206
+
207
+ └ source_1.foo
208
+ ~~~
209
+ - |
210
+ a.rb:109:17: [error] Type `(::Integer | nil)` does not have method `foo`
211
+ │ Diagnostic ID: Ruby::NoMethod
212
+
213
+ └ op_unary_match_1.foo
214
+ ~~~
215
+ b.rb:
216
+ diagnostics:
217
+ - |
218
+ b.rb:3:14: [error] Type `(::String | nil)` does not have method `foo`
219
+ │ Diagnostic ID: Ruby::NoMethod
220
+
221
+ └ match_ref_1.foo
222
+ ~~~
223
+ - |
224
+ b.rb:6:14: [error] Type `(::String | nil)` does not have method `foo`
225
+ │ Diagnostic ID: Ruby::NoMethod
226
+
227
+ └ match_ref_2.foo
228
+ ~~~
229
+ - |
230
+ b.rb:9:14: [error] Type `(::String | nil)` does not have method `foo`
231
+ │ Diagnostic ID: Ruby::NoMethod
232
+
233
+ └ match_ref_3.foo
234
+ ~~~
235
+ - |
236
+ b.rb:12:14: [error] Type `::Array[(::String | nil)]` does not have method `foo`
237
+ │ Diagnostic ID: Ruby::NoMethod
238
+
239
+ └ match_ref_4.foo
240
+ ~~~
241
+ - |
242
+ b.rb:15:14: [error] Type `::Array[(::String | nil)]` does not have method `foo`
243
+ │ Diagnostic ID: Ruby::NoMethod
244
+
245
+ └ match_ref_5.foo
246
+ ~~~
247
+ - |
248
+ b.rb:18:10: [error] Type `(::Integer | nil)` does not have method `foo`
249
+ │ Diagnostic ID: Ruby::NoMethod
250
+
251
+ └ begin_1.foo
252
+ ~~~
253
+ - |
254
+ b.rb:21:10: [error] Type `(::Integer | nil)` does not have method `foo`
255
+ │ Diagnostic ID: Ruby::NoMethod
256
+
257
+ └ begin_2.foo
258
+ ~~~
259
+ - |
260
+ b.rb:24:10: [error] Type `(::Integer | nil)` does not have method `foo`
261
+ │ Diagnostic ID: Ruby::NoMethod
262
+
263
+ └ begin_3.foo
264
+ ~~~
265
+ - |
266
+ b.rb:27:13: [error] Type `::Array[(::String | nil)]` does not have method `foo`
267
+ │ Diagnostic ID: Ruby::NoMethod
268
+
269
+ └ captures_1.foo
270
+ ~~~
271
+ - |
272
+ b.rb:30:8: [error] Type `(::Integer | nil)` does not have method `foo`
273
+ │ Diagnostic ID: Ruby::NoMethod
274
+
275
+ └ end_1.foo
276
+ ~~~
277
+ - |
278
+ b.rb:33:8: [error] Type `(::Integer | nil)` does not have method `foo`
279
+ │ Diagnostic ID: Ruby::NoMethod
280
+
281
+ └ end_2.foo
282
+ ~~~
283
+ - |
284
+ b.rb:36:8: [error] Type `(::Integer | nil)` does not have method `foo`
285
+ │ Diagnostic ID: Ruby::NoMethod
286
+
287
+ └ end_3.foo
288
+ ~~~
289
+ - |
290
+ b.rb:39:11: [error] Type `::Integer` does not have method `foo`
291
+ │ Diagnostic ID: Ruby::NoMethod
292
+
293
+ └ length_1.foo
294
+ ~~~
295
+ - |
296
+ b.rb:42:19: [error] Type `::Hash[::String, (::String | nil)]` does not have method `foo`
297
+ │ Diagnostic ID: Ruby::NoMethod
298
+
299
+ └ named_captures_1.foo
300
+ ~~~
301
+ - |
302
+ b.rb:45:10: [error] Type `::Array[::String]` does not have method `foo`
303
+ │ Diagnostic ID: Ruby::NoMethod
304
+
305
+ └ names_1.foo
306
+ ~~~
307
+ - |
308
+ b.rb:48:11: [error] Type `([::Integer, ::Integer] | [nil, nil])` does not have method `foo`
309
+ │ Diagnostic ID: Ruby::NoMethod
310
+
311
+ └ offset_1.foo
312
+ ~~~
313
+ - |
314
+ b.rb:51:11: [error] Type `([::Integer, ::Integer] | [nil, nil])` does not have method `foo`
315
+ │ Diagnostic ID: Ruby::NoMethod
316
+
317
+ └ offset_2.foo
318
+ ~~~
319
+ - |
320
+ b.rb:54:11: [error] Type `([::Integer, ::Integer] | [nil, nil])` does not have method `foo`
321
+ │ Diagnostic ID: Ruby::NoMethod
322
+
323
+ └ offset_3.foo
324
+ ~~~
325
+ - |
326
+ b.rb:57:15: [error] Type `::String` does not have method `foo`
327
+ │ Diagnostic ID: Ruby::NoMethod
328
+
329
+ └ post_match_1.foo
330
+ ~~~
331
+ - |
332
+ b.rb:60:14: [error] Type `::String` does not have method `foo`
333
+ │ Diagnostic ID: Ruby::NoMethod
334
+
335
+ └ pre_match_1.foo
336
+ ~~~
337
+ - |
338
+ b.rb:63:11: [error] Type `::Regexp` does not have method `foo`
339
+ │ Diagnostic ID: Ruby::NoMethod
340
+
341
+ └ regexp_1.foo
342
+ ~~~
343
+ - |
344
+ b.rb:66:9: [error] Type `::Integer` does not have method `foo`
345
+ │ Diagnostic ID: Ruby::NoMethod
346
+
347
+ └ size_1.foo
348
+ ~~~
349
+ - |
350
+ b.rb:69:11: [error] Type `::String` does not have method `foo`
351
+ │ Diagnostic ID: Ruby::NoMethod
352
+
353
+ └ string_1.foo
354
+ ~~~
355
+ - |
356
+ b.rb:72:9: [error] Type `::Array[(::String | nil)]` does not have method `foo`
357
+ │ Diagnostic ID: Ruby::NoMethod
358
+
359
+ └ to_a_1.foo
360
+ ~~~
361
+ - |
362
+ b.rb:75:14: [error] Type `::Array[(::String | nil)]` does not have method `foo`
363
+ │ Diagnostic ID: Ruby::NoMethod
364
+
365
+ └ values_at_1.foo
366
+ ~~~
367
+ - |
368
+ b.rb:78:14: [error] Type `::Array[(::String | nil)]` does not have method `foo`
369
+ │ Diagnostic ID: Ruby::NoMethod
370
+
371
+ └ values_at_2.foo
372
+ ~~~