typegap 0.1.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.
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ module Typegap
5
+ # What a Steep type says about nil, false, and classes. Every predicate
6
+ # answers only for a type Steep knows completely: untyped, a type variable,
7
+ # self, or an alias Steep did not expand says nothing, so a rule built on
8
+ # these stays silent there instead of guessing.
9
+ module TypeFacts
10
+
11
+ module_function
12
+
13
+ # @rbs type: untyped
14
+ #: (untyped) -> Array[untyped]
15
+ def members(type) = type.is_a?(Steep::AST::Types::Union) ? type.types : [type]
16
+
17
+ # @rbs type: untyped
18
+ #: (untyped) -> String?
19
+ def instance_name(type) = type.is_a?(Steep::AST::Types::Name::Instance) ? type.name.to_s : nil
20
+
21
+ # The class name of a member, with nil as NilClass and a literal as its class.
22
+ # @rbs type: untyped
23
+ #: (untyped) -> String?
24
+ def class_name(type)
25
+ return "::NilClass" if nil_type?(type)
26
+ return "::#{type.value.class}" if type.is_a?(Steep::AST::Types::Literal)
27
+
28
+ instance_name(type)
29
+ end
30
+
31
+ # @rbs type: untyped
32
+ #: (untyped) -> bool
33
+ def nil_type?(type) = type.is_a?(Steep::AST::Types::Nil) || instance_name(type) == "::NilClass"
34
+
35
+ # @rbs type: untyped
36
+ #: (untyped) -> bool
37
+ def bool_type?(type)
38
+ type.is_a?(Steep::AST::Types::Boolean) || type.is_a?(Steep::AST::Types::Logic::Base) ||
39
+ (type.is_a?(Steep::AST::Types::Literal) && [true, false].include?(type.value)) ||
40
+ %w[::TrueClass ::FalseClass].include?(instance_name(type))
41
+ end
42
+
43
+ # @rbs type: untyped
44
+ #: (untyped) -> bool
45
+ def can_be_false?(type)
46
+ type.is_a?(Steep::AST::Types::Boolean) || type.is_a?(Steep::AST::Types::Logic::Base) ||
47
+ (type.is_a?(Steep::AST::Types::Literal) && type.value == false) || instance_name(type) == "::FalseClass"
48
+ end
49
+
50
+ # @rbs type: untyped
51
+ #: (untyped) -> bool
52
+ def known?(type)
53
+ case type
54
+ when Steep::AST::Types::Any, Steep::AST::Types::Top, Steep::AST::Types::Bot, Steep::AST::Types::Var, Steep::AST::Types::Name::Alias, Steep::AST::Types::Void, Steep::AST::Types::Self, Steep::AST::Types::Instance, Steep::AST::Types::Class then false
55
+ when Steep::AST::Types::Union then type.types.all? { known?(_1) }
56
+ when Steep::AST::Types::Intersection then type.types.any? { known?(_1) }
57
+ else true
58
+ end
59
+ end
60
+
61
+ # @rbs type: untyped
62
+ #: (untyped) -> bool
63
+ def never_nil?(type)
64
+ return false unless type && known?(type)
65
+ return type.types.any? { never_nil?(_1) } if type.is_a?(Steep::AST::Types::Intersection)
66
+
67
+ members(type).none? { nil_type?(_1) }
68
+ end
69
+
70
+ # @rbs type: untyped
71
+ #: (untyped) -> bool
72
+ def never_falsy?(type)
73
+ return false unless never_nil?(type)
74
+ return type.types.any? { never_falsy?(_1) } if type.is_a?(Steep::AST::Types::Intersection)
75
+
76
+ members(type).none? { can_be_false?(_1) }
77
+ end
78
+
79
+ # @rbs type: untyped
80
+ #: (untyped) -> bool
81
+ def nilable?(type)
82
+ known?(type) && members(type).any? { nil_type?(_1) } && members(type).any? { !nil_type?(_1) }
83
+ end
84
+
85
+ # A union of literals such as `:open | :closed`, possibly with nil.
86
+ # @rbs type: untyped
87
+ #: (untyped) -> bool
88
+ def literal_union?(type)
89
+ known?(type) && type.is_a?(Steep::AST::Types::Union) &&
90
+ members(type).all? { _1.is_a?(Steep::AST::Types::Literal) || nil_type?(_1) } &&
91
+ members(type).any? { _1.is_a?(Steep::AST::Types::Literal) }
92
+ end
93
+
94
+ # @rbs type: untyped
95
+ # @rbs value: untyped
96
+ #: (untyped, untyped) -> bool
97
+ def includes_literal?(type, value) = members(type).any? { _1.is_a?(Steep::AST::Types::Literal) && _1.value == value }
98
+ end
99
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ module Typegap
5
+ VERSION = "0.1.0" #: String
6
+ end
data/lib/typegap.rb ADDED
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ require "json"
5
+ require "optparse"
6
+ require "steep"
7
+ require_relative "typegap/version"
8
+ require_relative "typegap/finding"
9
+ require_relative "typegap/rules"
10
+ require_relative "typegap/type_facts"
11
+ require_relative "typegap/project"
12
+ require_relative "typegap/source_check"
13
+ require_relative "typegap/signature_check"
14
+ require_relative "typegap/cli"
15
+
16
+ # typegap reports where a Ruby project's RBS types and its code disagree, on
17
+ # the typing Steep infers. It ports the type-aware rules of typescript-eslint.
18
+ module Typegap
19
+ # Every finding in a project, sorted by place. `paths` limits the Ruby files
20
+ # read; signature files are read only when no path is given.
21
+ #
22
+ # @rbs root: String
23
+ # @rbs paths: Array[String]
24
+ # @rbs rules: Array[String]
25
+ #: (root: String, ?paths: Array[String], ?rules: Array[String]) -> Array[Finding]
26
+ def self.run(root:, paths: [], rules: Rules.select(only: nil, except: []))
27
+ project = Project.new(root)
28
+ found = [] #: Array[Finding]
29
+ project.each_typing(paths) do |path, typing, builder|
30
+ found.concat(SourceCheck.new(path, typing, builder, rules).findings)
31
+ end
32
+ if paths.empty?
33
+ project.own_signature_paths.each do |path|
34
+ found.concat(SignatureCheck.new(path, File.read(File.join(project.root, path)), rules).findings)
35
+ end
36
+ end
37
+ found.sort_by(&:sort_key)
38
+ end
39
+ end
@@ -0,0 +1,30 @@
1
+ # Generated from lib/typegap/cli.rb with RBS::Inline
2
+
3
+ module Typegap
4
+ # The `typegap` command. It prints one finding per line, or one JSON object
5
+ # per line with `--json`, and exits 1 when there is a finding, so a CI job
6
+ # can run it as is.
7
+ class CLI
8
+ USAGE: String
9
+
10
+ # @rbs out: IO
11
+ # @rbs err: IO
12
+ def initialize: (?out: untyped, ?err: IO) -> void
13
+
14
+ # 0 with no finding, 1 with findings, 2 when the command cannot run.
15
+ # @rbs argv: Array[String]
16
+ # : (Array[String]) -> Integer
17
+ def run: (Array[String]) -> Integer
18
+
19
+ private
20
+
21
+ # @rbs argv: Array[String]
22
+ # : (Array[String]) -> Hash[Symbol, untyped]
23
+ def parse: (Array[String]) -> Hash[Symbol, untyped]
24
+
25
+ # @rbs findings: Array[Finding]
26
+ # @rbs json: bool
27
+ # : (Array[Finding], json: bool) -> void
28
+ def report: (Array[Finding], json: bool) -> void
29
+ end
30
+ end
@@ -0,0 +1,35 @@
1
+ # Generated from lib/typegap/finding.rb with RBS::Inline
2
+
3
+ module Typegap
4
+ # One place where the types and the code disagree, or where the code does
5
+ # what the types make unnecessary or impossible. It carries no severity: the
6
+ # rule name says what kind of gap it is, and the reader decides whether the
7
+ # code or the type is wrong.
8
+ class Finding
9
+ attr_reader path: String
10
+
11
+ attr_reader line: Integer
12
+
13
+ attr_reader column: Integer
14
+
15
+ attr_reader rule: String
16
+
17
+ attr_reader message: String
18
+
19
+ # @rbs path: String
20
+ # @rbs line: Integer
21
+ # @rbs column: Integer
22
+ # @rbs rule: String
23
+ # @rbs message: String
24
+ def initialize: (path: String, line: Integer, column: Integer, rule: String, message: String) -> void
25
+
26
+ # : () -> Array[String | Integer]
27
+ def sort_key: () -> Array[String | Integer]
28
+
29
+ # : () -> Hash[Symbol, String | Integer]
30
+ def to_h: () -> Hash[Symbol, String | Integer]
31
+
32
+ # : () -> String
33
+ def to_s: () -> String
34
+ end
35
+ end
@@ -0,0 +1,41 @@
1
+ # Generated from lib/typegap/project.rb with RBS::Inline
2
+
3
+ module Typegap
4
+ # Type checks a project the way `steep check` does, from its Steepfile, and
5
+ # hands each Ruby file's typing to a block. It reads Steep's own service
6
+ # instead of re-implementing inference, so a finding means what Steep
7
+ # inferred. That service is not a public API, so this file is the one place
8
+ # that touches it.
9
+ class Project
10
+ attr_reader root: String
11
+
12
+ # @rbs root: String
13
+ def initialize: (String root) -> void
14
+
15
+ # Each Ruby source file of a target, relative to the root, with its typing
16
+ # and the RBS definition builder of its target. A file Steep could not
17
+ # type (a syntax error) is skipped: `steep check` reports it.
18
+ #
19
+ # @rbs paths: Array[String]
20
+ # @rbs &block: (String, untyped, untyped) -> void
21
+ # : (Array[String]) { (String, untyped, untyped) -> void } -> void
22
+ def each_typing: (Array[String]) { (String, untyped, untyped) -> void } -> void
23
+
24
+ # The signature files under sig/, which hold this project's own types.
25
+ # Stubs of other gems (sig-deps/ and the like) are not this project's to fix.
26
+ # : () -> Array[String]
27
+ def own_signature_paths: () -> Array[String]
28
+
29
+ private
30
+
31
+ # : () -> void
32
+ def load: () -> void
33
+
34
+ # : () -> Array[Pathname]
35
+ def source_paths: () -> Array[Pathname]
36
+
37
+ # @rbs path: String
38
+ # : (String) -> String
39
+ def relative: (String) -> String
40
+ end
41
+ end
@@ -0,0 +1,36 @@
1
+ # Generated from lib/typegap/rules.rb with RBS::Inline
2
+
3
+ module Typegap
4
+ # The rules, each with the typescript-eslint rule it ports. A rule that is
5
+ # off by default reports too much to read as a list: it is a map to read
6
+ # with `--only`.
7
+ module Rules
8
+ class Rule < Data
9
+ attr_reader name(): untyped
10
+
11
+ attr_reader follows(): untyped
12
+
13
+ attr_reader default(): untyped
14
+
15
+ def self.new: (untyped name, untyped follows, untyped default) -> instance
16
+ | (name: untyped, follows: untyped, default: untyped) -> instance
17
+
18
+ def self.members: () -> [ :name, :follows, :default ]
19
+
20
+ def members: () -> [ :name, :follows, :default ]
21
+ end
22
+
23
+ ALL: Array[Rule]
24
+
25
+ NAMES: Array[String]
26
+
27
+ # The rule names that run: `only` when given, else every default rule,
28
+ # less `except`. An unknown name raises, so a typo does not silently run
29
+ # nothing.
30
+ #
31
+ # @rbs only: Array[String]?
32
+ # @rbs except: Array[String]
33
+ # : (only: Array[String]?, except: Array[String]) -> Array[String]
34
+ def self.select: (only: Array[String]?, except: Array[String]) -> Array[String]
35
+ end
36
+ end
@@ -0,0 +1,60 @@
1
+ # Generated from lib/typegap/signature_check.rb with RBS::Inline
2
+
3
+ module Typegap
4
+ # The rules that read one signature file, as written or as rbs-inline
5
+ # writes it. They report a type that says less than it seems to: a union
6
+ # that `untyped` swallows, a type parameter that ties nothing together, a
7
+ # getter and a setter that disagree.
8
+ #
9
+ # It reads the file's declarations only. It does not resolve names, so it
10
+ # needs no environment.
11
+ class SignatureCheck
12
+ # @rbs path: String
13
+ # @rbs text: String
14
+ # @rbs rules: Array[String]
15
+ def initialize: (String path, String text, Array[String] rules) -> void
16
+
17
+ # A file RBS cannot parse has no findings: `steep check` reports it.
18
+ # : () -> Array[Finding]
19
+ def findings: () -> Array[Finding]
20
+
21
+ private
22
+
23
+ # @rbs loc: untyped
24
+ # @rbs rule: String
25
+ # @rbs message: String
26
+ # : (untyped, String, String) -> void
27
+ def add: (untyped, String, String) -> void
28
+
29
+ # @rbs decl: untyped
30
+ # : (untyped) -> void
31
+ def decl: (untyped) -> void
32
+
33
+ # @rbs member: untyped
34
+ # : (untyped) -> void
35
+ def member: (untyped) -> void
36
+
37
+ # @rbs type: untyped
38
+ # : (untyped) -> void
39
+ def each_type: (untyped) -> void
40
+
41
+ # @rbs type: untyped
42
+ # : (untyped) -> void
43
+ def redundant: (untyped) -> void
44
+
45
+ # @rbs type: untyped
46
+ # : (untyped) -> bool
47
+ def nil_inside?: (untyped) -> bool
48
+
49
+ # A type parameter used once relates nothing: `[T] (T) -> void` takes
50
+ # anything, as `(untyped) -> void` or `(top) -> void` does.
51
+ # @rbs member: untyped
52
+ # @rbs method_type: untyped
53
+ # : (untyped, untyped) -> void
54
+ def type_params: (untyped, untyped) -> void
55
+
56
+ # @rbs decl: untyped
57
+ # : (untyped) -> void
58
+ def getter_setter: (untyped) -> void
59
+ end
60
+ end
@@ -0,0 +1,300 @@
1
+ # Generated from lib/typegap/source_check.rb with RBS::Inline
2
+
3
+ module Typegap
4
+ # The rules that read one Ruby file's typing. Each rule reports code that
5
+ # the inferred types make unnecessary, impossible, or easy to misuse. In a
6
+ # codebase typed with RBS, most of these are places where the type and the
7
+ # code disagree: either the check is dead, or the type says too much.
8
+ #
9
+ # It reads Steep's typing and the RBS definitions; it does not infer types
10
+ # of its own, and it never changes a file.
11
+ class SourceCheck
12
+ include TypeFacts
13
+
14
+ # RBS core types these as never nil although they return nil (Hash#[] on
15
+ # a missing key, Array#first on an empty array, Thread#join on a
16
+ # timeout). Trusting them would report the very nil checks that keep the
17
+ # code safe.
18
+ NIL_HIDING_CALLS: Array[Symbol]
19
+
20
+ BASE_TO_S: Array[String]
21
+
22
+ CONVERSIONS: Hash[Symbol, String]
23
+
24
+ KERNEL_CONVERSIONS: Hash[Symbol, String]
25
+
26
+ VALUE_CLASSES: Array[String]
27
+
28
+ COLLECTIONS: Array[String]
29
+
30
+ BLOCKS: Array[Symbol]
31
+
32
+ ITERATORS: Array[Symbol]
33
+
34
+ # @rbs path: String
35
+ # @rbs typing: untyped
36
+ # @rbs builder: untyped
37
+ # @rbs rules: Array[String]
38
+ def initialize: (String path, untyped typing, untyped builder, Array[String] rules) -> void
39
+
40
+ # : () -> Array[Finding]
41
+ def findings: () -> Array[Finding]
42
+
43
+ private
44
+
45
+ # @rbs node_or_loc: untyped
46
+ # @rbs rule: String
47
+ # @rbs message: String
48
+ # : (untyped, String, String) -> void
49
+ def add: (untyped, String, String) -> void
50
+
51
+ # @rbs node: untyped
52
+ # : (untyped) -> String
53
+ def src: (untyped) -> String
54
+
55
+ # @rbs node: untyped
56
+ # @rbs parent: untyped
57
+ # @rbs nesting: Array[String]
58
+ # @rbs singleton: bool
59
+ # : (untyped, untyped, Array[String], bool) -> void
60
+ def walk: (untyped, untyped, Array[String], bool) -> void
61
+
62
+ # @rbs node: untyped
63
+ # @rbs parent: untyped
64
+ # @rbs nesting: Array[String]
65
+ # @rbs singleton: bool
66
+ # : (untyped, untyped, Array[String], bool) -> void
67
+ def check: (untyped, untyped, Array[String], bool) -> void
68
+
69
+ # @rbs node: untyped
70
+ # : (untyped) -> untyped
71
+ def type_of: (untyped) -> untyped
72
+
73
+ # @rbs node: untyped
74
+ # : (untyped) -> untyped
75
+ def raw_type: (untyped) -> untyped
76
+
77
+ # @rbs name: String
78
+ # : (String) -> Array[String]?
79
+ def ancestors: (String) -> Array[String]?
80
+
81
+ # @rbs name: String
82
+ # : (String) -> untyped
83
+ def instance_definition: (String) -> untyped
84
+
85
+ # @rbs name: String
86
+ # : (String) -> untyped
87
+ def singleton_definition: (String) -> untyped
88
+
89
+ # @rbs name: String
90
+ # : (String) -> bool
91
+ def class_entry?: (String) -> bool
92
+
93
+ # @rbs type_name: String
94
+ # @rbs method: Symbol
95
+ # : (String, Symbol) -> String?
96
+ def method_owner: (String, Symbol) -> String?
97
+
98
+ # @rbs node: untyped
99
+ # : (untyped) -> String?
100
+ def const_name: (untyped) -> String?
101
+
102
+ # @rbs node: untyped
103
+ # : (untyped) -> void
104
+ def safe_navigation: (untyped) -> void
105
+
106
+ # @rbs node: untyped
107
+ # @rbs parent: untyped
108
+ # : (untyped, untyped) -> void
109
+ def send_rules: (untyped, untyped) -> void
110
+
111
+ # @rbs node: untyped
112
+ # @rbs receiver: untyped
113
+ # @rbs name: Symbol
114
+ # @rbs args: Array[untyped]
115
+ # : (untyped, untyped, Symbol, Array[untyped]) -> void
116
+ def nil_check: (untyped, untyped, Symbol, Array[untyped]) -> void
117
+
118
+ # @rbs cond: untyped
119
+ # @rbs kind: Symbol
120
+ # : (untyped, Symbol) -> void
121
+ def condition: (untyped, Symbol) -> void
122
+
123
+ # @rbs node: untyped
124
+ # : (untyped) -> void
125
+ def or_rules: (untyped) -> void
126
+
127
+ # `a&.x? || b&.y?` is logic, not a default: false there is meant to fall
128
+ # through. `flag || true` is a default, and the very bug this rule is for.
129
+ #
130
+ # @rbs right: untyped
131
+ # : (untyped) -> bool
132
+ def boolean_logic?: (untyped) -> bool
133
+
134
+ # @rbs node: untyped
135
+ # @rbs receiver: untyped
136
+ # @rbs name: Symbol
137
+ # @rbs args: Array[untyped]
138
+ # : (untyped, untyped, Symbol, Array[untyped]) -> void
139
+ def type_check: (untyped, untyped, Symbol, Array[untyped]) -> void
140
+
141
+ # @rbs node: untyped
142
+ # @rbs value: untyped
143
+ # @rbs const: untyped
144
+ # : (untyped, untyped, untyped) -> void
145
+ def class_check: (untyped, untyped, untyped) -> void
146
+
147
+ # Only classes can be disjoint: any object can include a module.
148
+ #
149
+ # @rbs klass: String
150
+ # @rbs names: Array[String?]
151
+ # @rbs lists: Array[Array[String]?]
152
+ # : (String, Array[String?], Array[Array[String]?]) -> bool
153
+ def disjoint?: (String, Array[String?], Array[Array[String]?]) -> bool
154
+
155
+ # @rbs node: untyped
156
+ # @rbs receiver: untyped
157
+ # @rbs method: Symbol
158
+ # : (untyped, untyped, Symbol) -> void
159
+ def respond_check: (untyped, untyped, Symbol) -> void
160
+
161
+ # @rbs node: untyped
162
+ # @rbs receiver: untyped
163
+ # @rbs name: Symbol
164
+ # @rbs args: Array[untyped]
165
+ # : (untyped, untyped, Symbol, Array[untyped]) -> void
166
+ def boolean_compare: (untyped, untyped, Symbol, Array[untyped]) -> void
167
+
168
+ # @rbs node: untyped
169
+ # @rbs receiver: untyped
170
+ # @rbs name: Symbol
171
+ # @rbs args: Array[untyped]
172
+ # : (untyped, untyped, Symbol, Array[untyped]) -> void
173
+ def conversion: (untyped, untyped, Symbol, Array[untyped]) -> void
174
+
175
+ # [readable, value] for a literal node; nil for anything else.
176
+ #
177
+ # @rbs node: untyped
178
+ # : (untyped) -> [bool, untyped]
179
+ def literal_value: (untyped) -> [ bool, untyped ]
180
+
181
+ # @rbs node: untyped
182
+ # @rbs receiver: untyped
183
+ # @rbs name: Symbol
184
+ # @rbs args: Array[untyped]
185
+ # : (untyped, untyped, Symbol, Array[untyped]) -> void
186
+ def literal_comparison: (untyped, untyped, Symbol, Array[untyped]) -> void
187
+
188
+ # @rbs node: untyped
189
+ # @rbs parent: untyped
190
+ # : (untyped, untyped) -> bool
191
+ def statement?: (untyped, untyped) -> bool
192
+
193
+ # @rbs node: untyped
194
+ # @rbs parent: untyped
195
+ # @rbs receiver: untyped
196
+ # @rbs name: Symbol
197
+ # : (untyped, untyped, untyped, Symbol) -> void
198
+ def unused_result: (untyped, untyped, untyped, Symbol) -> void
199
+
200
+ # @rbs klass: String
201
+ # @rbs name: Symbol
202
+ # : (String, Symbol) -> bool
203
+ def bang?: (String, Symbol) -> bool
204
+
205
+ # @rbs node: untyped
206
+ # @rbs parent: untyped
207
+ # : (untyped, untyped) -> void
208
+ def void_used: (untyped, untyped) -> void
209
+
210
+ # @rbs node: untyped
211
+ # @rbs receiver: untyped
212
+ # : (untyped, untyped) -> void
213
+ def untyped_call: (untyped, untyped) -> void
214
+
215
+ # @rbs node: untyped
216
+ # @rbs parent: untyped
217
+ # @rbs receiver: untyped
218
+ # @rbs name: Symbol
219
+ # @rbs args: Array[untyped]
220
+ # : (untyped, untyped, untyped, Symbol, Array[untyped]) -> void
221
+ def sort_comparable: (untyped, untyped, untyped, Symbol, Array[untyped]) -> void
222
+
223
+ # @rbs node: untyped
224
+ # : (untyped) -> void
225
+ def interpolation: (untyped) -> void
226
+
227
+ # @rbs node: untyped
228
+ # @rbs part: untyped
229
+ # @rbs expr: untyped
230
+ # @rbs type: untyped
231
+ # : (untyped, untyped, untyped, untyped) -> void
232
+ def interpolated: (untyped, untyped, untyped, untyped) -> void
233
+
234
+ # @rbs node: untyped
235
+ # : (untyped) -> void
236
+ def case_rules: (untyped) -> void
237
+
238
+ # @rbs subject: untyped
239
+ # @rbs type: untyped
240
+ # @rbs conds: Array[untyped]
241
+ # : (untyped, untyped, Array[untyped]) -> void
242
+ def impossible_whens: (untyped, untyped, Array[untyped]) -> void
243
+
244
+ # @rbs node: untyped
245
+ # @rbs subject: untyped
246
+ # @rbs type: untyped
247
+ # @rbs conds: Array[untyped]
248
+ # : (untyped, untyped, untyped, Array[untyped]) -> void
249
+ def exhaustive: (untyped, untyped, untyped, Array[untyped]) -> void
250
+
251
+ # @rbs member: untyped
252
+ # @rbs conds: Array[untyped]
253
+ # : (untyped, Array[untyped]) -> bool
254
+ def covered?: (untyped, Array[untyped]) -> bool
255
+
256
+ # @rbs node: untyped
257
+ # @rbs parent: untyped
258
+ # : (untyped, untyped) -> void
259
+ def block_rules: (untyped, untyped) -> void
260
+
261
+ # @rbs node: untyped
262
+ # @rbs parent: untyped
263
+ # @rbs name: Symbol
264
+ # @rbs klass: String
265
+ # : (untyped, untyped, Symbol, String) -> void
266
+ def prefer_find: (untyped, untyped, Symbol, String) -> void
267
+
268
+ # @rbs node: untyped
269
+ # : (untyped) -> void
270
+ def assertion: (untyped) -> void
271
+
272
+ # @rbs node: untyped
273
+ # : (untyped) -> bool
274
+ def hint_shaped?: (untyped) -> bool
275
+
276
+ # @rbs node: untyped
277
+ # : (untyped) -> void
278
+ def splat: (untyped) -> void
279
+
280
+ # @rbs node: untyped
281
+ # @rbs nesting: Array[String]
282
+ # @rbs singleton: bool
283
+ # : (untyped, Array[String], bool) -> void
284
+ def def_rules: (untyped, Array[String], bool) -> void
285
+
286
+ # @rbs type: untyped
287
+ # : (untyped) -> bool
288
+ def boolish?: (untyped) -> bool
289
+
290
+ # Steep finds these itself, but its default diagnostic levels hide them as hints.
291
+ # : () -> void
292
+ def steep_hidden: () -> void
293
+
294
+ # Steep decides a branch is unreachable from the same types the rules
295
+ # above distrust: `h[k].nil?` is never true to it. Such a branch is kept.
296
+ # @rbs node: untyped
297
+ # : (untyped) -> bool
298
+ def reads_hidden_nil?: (untyped) -> bool
299
+ end
300
+ end