steep 1.7.0.dev.4 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -0
  3. data/README.md +18 -0
  4. data/guides/src/gem-rbs-collection/gem-rbs-collection.md +7 -24
  5. data/lib/steep/rake_task.rb +132 -0
  6. data/lib/steep/type_construction.rb +1 -0
  7. data/lib/steep/version.rb +1 -1
  8. data/steep.gemspec +4 -1
  9. metadata +4 -143
  10. data/.github/dependabot.yml +0 -28
  11. data/.github/workflows/ruby-windows.yml +0 -35
  12. data/.github/workflows/ruby.yml +0 -32
  13. data/.vscode/steep-shared.code-snippets +0 -41
  14. data/Gemfile +0 -14
  15. data/Gemfile.lock +0 -104
  16. data/Gemfile.steep +0 -0
  17. data/gemfile_steep/Gemfile +0 -3
  18. data/gemfile_steep/Gemfile.lock +0 -77
  19. data/rbs_collection.steep.lock.yaml +0 -108
  20. data/rbs_collection.steep.yaml +0 -23
  21. data/sig/shims/bundler.rbs +0 -3
  22. data/sig/shims/concurrent-ruby.rbs +0 -39
  23. data/sig/shims/exception.rbs +0 -4
  24. data/sig/shims/language-server_protocol.rbs +0 -450
  25. data/sig/shims/parser/comment.rbs +0 -33
  26. data/sig/shims/parser/nodes.rbs +0 -252
  27. data/sig/shims/parser/source/map.rbs +0 -146
  28. data/sig/shims/parser/source/range.rbs +0 -237
  29. data/sig/shims/parser.rbs +0 -69
  30. data/sig/shims/string.rbs +0 -4
  31. data/sig/shims/tagged_logging.rbs +0 -6
  32. data/sig/shims/yaml.rbs +0 -4
  33. data/sig/steep/annotation_parser.rbs +0 -60
  34. data/sig/steep/ast/annotation/collection.rbs +0 -78
  35. data/sig/steep/ast/annotation.rbs +0 -121
  36. data/sig/steep/ast/builtin.rbs +0 -69
  37. data/sig/steep/ast/ignore.rbs +0 -66
  38. data/sig/steep/ast/node/type_application.rbs +0 -31
  39. data/sig/steep/ast/node/type_assertion.rbs +0 -32
  40. data/sig/steep/ast/types/any.rbs +0 -29
  41. data/sig/steep/ast/types/boolean.rbs +0 -31
  42. data/sig/steep/ast/types/bot.rbs +0 -29
  43. data/sig/steep/ast/types/class.rbs +0 -33
  44. data/sig/steep/ast/types/factory.rbs +0 -110
  45. data/sig/steep/ast/types/helper.rbs +0 -24
  46. data/sig/steep/ast/types/instance.rbs +0 -33
  47. data/sig/steep/ast/types/intersection.rbs +0 -40
  48. data/sig/steep/ast/types/literal.rbs +0 -35
  49. data/sig/steep/ast/types/logic.rbs +0 -83
  50. data/sig/steep/ast/types/name.rbs +0 -84
  51. data/sig/steep/ast/types/nil.rbs +0 -31
  52. data/sig/steep/ast/types/proc.rbs +0 -53
  53. data/sig/steep/ast/types/record.rbs +0 -39
  54. data/sig/steep/ast/types/self.rbs +0 -33
  55. data/sig/steep/ast/types/top.rbs +0 -29
  56. data/sig/steep/ast/types/tuple.rbs +0 -37
  57. data/sig/steep/ast/types/union.rbs +0 -40
  58. data/sig/steep/ast/types/var.rbs +0 -42
  59. data/sig/steep/ast/types/void.rbs +0 -29
  60. data/sig/steep/ast/types.rbs +0 -16
  61. data/sig/steep/cli.rbs +0 -55
  62. data/sig/steep/diagnostic/deprecated/else_on_exhaustive_case.rbs +0 -13
  63. data/sig/steep/diagnostic/deprecated/unknown_constant_assigned.rbs +0 -15
  64. data/sig/steep/diagnostic/helper.rbs +0 -15
  65. data/sig/steep/diagnostic/lsp_formatter.rbs +0 -36
  66. data/sig/steep/diagnostic/ruby.rbs +0 -703
  67. data/sig/steep/diagnostic/signature.rbs +0 -252
  68. data/sig/steep/drivers/annotations.rbs +0 -17
  69. data/sig/steep/drivers/check.rbs +0 -33
  70. data/sig/steep/drivers/checkfile.rbs +0 -27
  71. data/sig/steep/drivers/diagnostic_printer.rbs +0 -25
  72. data/sig/steep/drivers/init.rbs +0 -19
  73. data/sig/steep/drivers/langserver.rbs +0 -36
  74. data/sig/steep/drivers/print_project.rbs +0 -15
  75. data/sig/steep/drivers/stats.rbs +0 -47
  76. data/sig/steep/drivers/utils/driver_helper.rbs +0 -25
  77. data/sig/steep/drivers/utils/jobs_option.rbs +0 -19
  78. data/sig/steep/drivers/validate.rbs +0 -15
  79. data/sig/steep/drivers/vendor.rbs +0 -19
  80. data/sig/steep/drivers/watch.rbs +0 -27
  81. data/sig/steep/drivers/worker.rbs +0 -29
  82. data/sig/steep/equatable.rbs +0 -11
  83. data/sig/steep/expectations.rbs +0 -72
  84. data/sig/steep/index/rbs_index.rbs +0 -141
  85. data/sig/steep/index/signature_symbol_provider.rbs +0 -41
  86. data/sig/steep/index/source_index.rbs +0 -63
  87. data/sig/steep/interface/block.rbs +0 -41
  88. data/sig/steep/interface/builder.rbs +0 -111
  89. data/sig/steep/interface/function.rbs +0 -271
  90. data/sig/steep/interface/method_type.rbs +0 -105
  91. data/sig/steep/interface/shape.rbs +0 -80
  92. data/sig/steep/interface/substitution.rbs +0 -51
  93. data/sig/steep/interface/type_param.rbs +0 -43
  94. data/sig/steep/method_name.rbs +0 -30
  95. data/sig/steep/module_helper.rbs +0 -16
  96. data/sig/steep/node_helper.rbs +0 -91
  97. data/sig/steep/path_helper.rbs +0 -15
  98. data/sig/steep/project/dsl.rbs +0 -108
  99. data/sig/steep/project/options.rbs +0 -47
  100. data/sig/steep/project/pattern.rbs +0 -47
  101. data/sig/steep/project/target.rbs +0 -25
  102. data/sig/steep/project.rbs +0 -26
  103. data/sig/steep/range_extension.rbs +0 -7
  104. data/sig/steep/server/base_worker.rbs +0 -49
  105. data/sig/steep/server/change_buffer.rbs +0 -38
  106. data/sig/steep/server/delay_queue.rbs +0 -37
  107. data/sig/steep/server/interaction_worker.rbs +0 -90
  108. data/sig/steep/server/lsp_formatter.rbs +0 -63
  109. data/sig/steep/server/master.rbs +0 -299
  110. data/sig/steep/server/type_check_worker.rbs +0 -141
  111. data/sig/steep/server/worker_process.rbs +0 -97
  112. data/sig/steep/services/completion_provider.rbs +0 -264
  113. data/sig/steep/services/content_change.rbs +0 -37
  114. data/sig/steep/services/file_loader.rbs +0 -21
  115. data/sig/steep/services/goto_service.rbs +0 -106
  116. data/sig/steep/services/hover_provider/rbs.rbs +0 -47
  117. data/sig/steep/services/hover_provider/ruby.rbs +0 -127
  118. data/sig/steep/services/hover_provider/singleton_methods.rbs +0 -11
  119. data/sig/steep/services/path_assignment.rbs +0 -21
  120. data/sig/steep/services/signature_help_provider.rbs +0 -51
  121. data/sig/steep/services/signature_service.rbs +0 -156
  122. data/sig/steep/services/stats_calculator.rbs +0 -41
  123. data/sig/steep/services/type_check_service.rbs +0 -112
  124. data/sig/steep/services/type_name_completion.rbs +0 -135
  125. data/sig/steep/signature/validator.rbs +0 -85
  126. data/sig/steep/source/ignore_ranges.rbs +0 -38
  127. data/sig/steep/source.rbs +0 -105
  128. data/sig/steep/subtyping/cache.rbs +0 -17
  129. data/sig/steep/subtyping/check.rbs +0 -131
  130. data/sig/steep/subtyping/constraints.rbs +0 -111
  131. data/sig/steep/subtyping/relation.rbs +0 -63
  132. data/sig/steep/subtyping/result.rbs +0 -179
  133. data/sig/steep/subtyping/variable_variance.rbs +0 -25
  134. data/sig/steep/thread_waiter.rbs +0 -13
  135. data/sig/steep/type_construction.rbs +0 -542
  136. data/sig/steep/type_inference/block_params.rbs +0 -170
  137. data/sig/steep/type_inference/case_when.rbs +0 -130
  138. data/sig/steep/type_inference/constant_env.rbs +0 -29
  139. data/sig/steep/type_inference/context.rbs +0 -216
  140. data/sig/steep/type_inference/context_array.rbs +0 -38
  141. data/sig/steep/type_inference/logic_type_interpreter.rbs +0 -108
  142. data/sig/steep/type_inference/method_call.rbs +0 -124
  143. data/sig/steep/type_inference/method_params.rbs +0 -127
  144. data/sig/steep/type_inference/multiple_assignment.rbs +0 -76
  145. data/sig/steep/type_inference/send_args.rbs +0 -243
  146. data/sig/steep/type_inference/type_env.rbs +0 -160
  147. data/sig/steep/type_inference/type_env_builder.rbs +0 -81
  148. data/sig/steep/typing.rbs +0 -75
  149. data/sig/steep.rbs +0 -45
@@ -1,271 +0,0 @@
1
- module Steep
2
- module Interface
3
- class Function
4
- class Params
5
- module Utils
6
- def union: (*AST::Types::t types, ?null: bool) -> AST::Types::t
7
-
8
- def intersection: (*AST::Types::t types) -> AST::Types::t
9
- end
10
-
11
- type t = PositionalParams::param | KeywordParams
12
-
13
- class PositionalParams
14
- class Base
15
- attr_reader type: AST::Types::t
16
-
17
- def initialize: (AST::Types::t `type`) -> void
18
-
19
- def ==: (untyped other) -> bool
20
-
21
- alias eql? ==
22
-
23
- def hash: () -> Integer
24
-
25
- def subst: (Substitution s) -> self
26
-
27
- def var_type: () -> AST::Types::t
28
-
29
- def map_type: () { (AST::Types::t) -> AST::Types::t } -> self
30
- | () -> Enumerator[AST::Types::t, void]
31
- end
32
-
33
- class Required < Base
34
- end
35
-
36
- class Optional < Base
37
- end
38
-
39
- class Rest < Base
40
- end
41
-
42
- type param = Required | Optional | Rest
43
-
44
- attr_reader head: param
45
-
46
- attr_reader tail: PositionalParams?
47
-
48
- def initialize: (head: param, tail: PositionalParams?) -> void
49
-
50
- def self.required: (AST::Types::t `type`, ?PositionalParams? tail) -> PositionalParams
51
-
52
- def self.optional: (AST::Types::t `type`, ?PositionalParams? tail) -> PositionalParams
53
-
54
- def self.rest: (AST::Types::t `type`, ?PositionalParams? tail) -> PositionalParams
55
-
56
- def to_ary: () -> [param, PositionalParams?]
57
-
58
- def map: () { (param) -> param } -> PositionalParams
59
-
60
- def map_type: () { (AST::Types::t) -> AST::Types::t } -> PositionalParams
61
- | () -> Enumerator[AST::Types::t, void]
62
-
63
- def subst: (Substitution s) -> PositionalParams
64
-
65
- def ==: (untyped other) -> bool
66
-
67
- alias eql? ==
68
-
69
- def hash: () -> Integer
70
-
71
- def each: () { (param) -> void } -> void
72
- | () -> Enumerator[param, void]
73
-
74
- def each_type: () { (AST::Types::t) -> void } -> void
75
- | () -> Enumerator[AST::Types::t, void]
76
-
77
- def size: () -> Integer
78
-
79
- def self.build: (required: Array[AST::Types::t], optional: Array[AST::Types::t], rest: AST::Types::t?) -> PositionalParams?
80
-
81
- extend Utils
82
-
83
- # Calculates xs + ys.
84
- # Never fails.
85
- def self.merge_for_overload: (PositionalParams? xs, PositionalParams? ys) -> PositionalParams?
86
-
87
- # xs | ys
88
- def self.merge_for_union: (PositionalParams? xs, PositionalParams? ys) -> PositionalParams?
89
-
90
- # Calculates xs & ys.
91
- # Raises when failed.
92
- #
93
- def self.merge_for_intersection: (PositionalParams? xs, PositionalParams? ys) -> PositionalParams?
94
- end
95
-
96
- class KeywordParams
97
- attr_reader requireds: Hash[Symbol, AST::Types::t]
98
-
99
- attr_reader optionals: Hash[Symbol, AST::Types::t]
100
-
101
- attr_reader rest: AST::Types::t?
102
-
103
- def initialize: (?requireds: ::Hash[Symbol, AST::Types::t], ?optionals: ::Hash[Symbol, AST::Types::t], ?rest: AST::Types::t?) -> void
104
-
105
- def ==: (untyped other) -> bool
106
-
107
- alias eql? ==
108
-
109
- def hash: () -> Integer
110
-
111
- def update: (?requireds: Hash[Symbol, AST::Types::t], ?optionals: Hash[Symbol, AST::Types::t], ?rest: AST::Types::t?) -> KeywordParams
112
-
113
- def empty?: () -> bool
114
-
115
- def each: () { ([Symbol?, AST::Types::t]) -> void } -> void
116
- | () -> Enumerator[[Symbol?, AST::Types::t], void]
117
-
118
- def each_type: () { (AST::Types::t) -> void } -> void
119
- | () -> Enumerator[AST::Types::t, void]
120
-
121
- def map_type: () { (AST::Types::t) -> AST::Types::t } -> KeywordParams
122
- | () -> Enumerator[AST::Types::t, KeywordParams]
123
-
124
- def subst: (Substitution s) -> KeywordParams
125
-
126
- def size: () -> Integer
127
-
128
- def keywords: () -> Set[Symbol]
129
-
130
- include Utils
131
-
132
- # For overloading
133
- def +: (KeywordParams other) -> KeywordParams
134
-
135
- # For union
136
- def |: (KeywordParams other) -> KeywordParams
137
-
138
- # For intersection
139
- def &: (KeywordParams other) -> KeywordParams?
140
- end
141
-
142
- def required: () -> Array[AST::Types::t]
143
-
144
- def optional: () -> Array[AST::Types::t]
145
-
146
- %a{pure} def rest: () -> AST::Types::t?
147
-
148
- attr_reader positional_params: PositionalParams?
149
-
150
- attr_reader keyword_params: KeywordParams
151
-
152
- def self.build: (?required: Array[AST::Types::t], ?optional: Array[AST::Types::t], ?rest: AST::Types::t?, ?required_keywords: ::Hash[Symbol, AST::Types::t], ?optional_keywords: ::Hash[Symbol, AST::Types::t], ?rest_keywords: AST::Types::t?) -> Params
153
-
154
- def initialize: (positional_params: PositionalParams?, keyword_params: KeywordParams) -> void
155
-
156
- def update: (?positional_params: PositionalParams?, ?keyword_params: KeywordParams) -> Params
157
-
158
- def first_param: () -> PositionalParams::param?
159
-
160
- def with_first_param: (PositionalParams::param) -> Params
161
-
162
- def has_positional?: () -> bool
163
-
164
- def self.empty: () -> Params
165
-
166
- def ==: (untyped other) -> bool
167
-
168
- alias eql? ==
169
-
170
- def hash: () -> Integer
171
-
172
- def flat_unnamed_params: () -> Array[[:required | :optional, AST::Types::t]]
173
-
174
- def flat_keywords: () -> Hash[Symbol, AST::Types::t]
175
-
176
- def required_keywords: () -> Hash[Symbol, AST::Types::t]
177
-
178
- def optional_keywords: () -> Hash[Symbol, AST::Types::t]
179
-
180
- %a{pure} def rest_keywords: () -> AST::Types::t?
181
-
182
- def has_keywords?: () -> bool
183
-
184
- def each_positional_param: () { (PositionalParams::Base) -> void } -> void
185
-
186
- def without_keywords: () -> Params
187
-
188
- def drop_first: () -> Params
189
-
190
- def each_type: () { (AST::Types::t) -> void } -> void
191
- | () -> Enumerator[AST::Types::t, void]
192
-
193
- @fvs: Set[AST::Types::variable]?
194
- def free_variables: () -> Set[AST::Types::variable]
195
-
196
- def closed?: () -> bool
197
-
198
- def subst: (Substitution s) -> Params
199
-
200
- def size: () -> Integer
201
-
202
- def to_s: () -> ::String
203
-
204
- def map_type: () { (AST::Types::t) -> AST::Types::t } -> Params
205
-
206
- def empty?: () -> bool
207
-
208
- # Returns true if all arguments are non-required.
209
- def optional?: () -> bool
210
-
211
- # self + params returns a new params for overloading.
212
- #
213
- def +: (Params other) -> Params
214
-
215
- # Returns the intersection between self and other.
216
- # Returns nil if the intersection cannot be computed.
217
- #
218
- # (self & other) <: self
219
- # (self & other) <: other
220
- #
221
- # `self & other` accept `arg` if `arg` is acceptable for both of `self` and `other`.
222
- #
223
- def &: (Params other) -> Params?
224
-
225
- # Returns the union between self and other.
226
- #
227
- # self <: (self | other)
228
- # other <: (self | other)
229
- #
230
- # `self | other` accept `arg` if `self` accepts `arg` or `other` accepts `arg`.
231
- #
232
- def |: (Params other) -> Params?
233
- end
234
-
235
- type location = RBS::Location[untyped, untyped]
236
-
237
- # Returns `nil` for `RBS::Types::UntypedFunction`
238
- attr_reader params: Params?
239
-
240
- attr_reader return_type: AST::Types::t
241
-
242
- attr_reader location: location?
243
-
244
- def initialize: (params: Params?, return_type: AST::Types::t, location: location?) -> void
245
-
246
- def ==: (untyped other) -> bool
247
-
248
- alias eql? ==
249
-
250
- def hash: () -> Integer
251
-
252
- @fvs: Set[AST::Types::variable]?
253
- def free_variables: () -> Set[AST::Types::variable]
254
-
255
- def subst: (Substitution s) -> Function
256
-
257
- alias each_child each_type
258
-
259
- def each_type: () { (AST::Types::t) -> void } -> void
260
- | () -> Enumerator[AST::Types::t, void]
261
-
262
- def map_type: () { (AST::Types::t) -> AST::Types::t } -> Function
263
-
264
- def with: (?params: Params?, ?return_type: AST::Types::t) -> Function
265
-
266
- def to_s: () -> ::String
267
-
268
- def closed?: () -> bool
269
- end
270
- end
271
- end
@@ -1,105 +0,0 @@
1
- use Steep::TypeInference::MethodCall::MethodDecl
2
-
3
- module Steep
4
- module Interface
5
- class MethodType
6
- attr_reader type_params: Array[TypeParam]
7
-
8
- attr_reader type: Function
9
-
10
- attr_reader block: Block?
11
-
12
- attr_reader method_decls: Set[MethodDecl]
13
-
14
- @fvs: Set[Symbol]
15
-
16
- def initialize: (type_params: Array[TypeParam], type: Function, block: Block?, method_decls: Set[MethodDecl]) -> void
17
-
18
- def ==: (untyped other) -> bool
19
-
20
- alias eql? ==
21
-
22
- def hash: () -> Integer
23
-
24
- def free_variables: () -> Set[Symbol]
25
-
26
- def subst: (Substitution s) -> MethodType
27
-
28
- def each_type: () { (AST::Types::t) -> void } -> void
29
- | () -> Enumerator[AST::Types::t, void]
30
-
31
- def instantiate: (Substitution s) -> MethodType
32
-
33
- def with: (?type_params: Array[TypeParam], ?type: Function, ?block: Block?, ?method_decls: Set[MethodDecl]) -> MethodType
34
-
35
- def to_s: () -> ::String
36
-
37
- def map_type: () { (AST::Types::t) -> AST::Types::t } -> MethodType
38
-
39
- # Returns a new method type which can be used for the method implementation type of both `self` and `other`.
40
- #
41
- def unify_overload: (MethodType other) -> MethodType
42
-
43
- alias + unify_overload
44
-
45
- def equals_modulo_type_params?: (MethodType other) -> bool
46
-
47
- # Returns a method type which is a super-type of both `type1` and `type2`.
48
- # `type1` <: union(`type1`, `type2`) && `type2` <: union(`type1`, `type2`)
49
- #
50
- # Returns `nil` if `type1` and `type2` are incompatible.
51
- #
52
- # This tries to generate the best result for polymorphic methods, but the support is limited.
53
- # It works when:
54
- #
55
- # * `type1` and `type2` are equal modulo type parameters (`[A] () -> A` | `[B] () -> B` → `[A] () -> A`), or
56
- # * The type parameter occurences are identical (`[A] (::Integer) -> A` | `[B] (::String) -> B` → `[A] (::Integer & ::String) -> A`)
57
- #
58
- # Otherwise it fails (returns `nil`).
59
- #
60
- def self.union: (MethodType type1, MethodType type2, Subtyping::Check) -> MethodType?
61
-
62
- # Returns a method type which is a sub-type of both `type1` and `type2`.
63
- #
64
- # ```
65
- # intersection(type1, type2) <: type1 && intersection(type1, type2) <: type2
66
- # ```
67
- #
68
- # Returns `nil` if `type1` and `type2` are incompatible.
69
- #
70
- # This tries to generate the best result for polymorphic methods, but the support is limited.
71
- # It works when:
72
- #
73
- # * `type1` and `type2` are equal modulo type parameters (`[A] () -> A` & `[B] () -> B` → `[A] () -> A`), or
74
- # * The type parameter occurences are identical (`[A] (::Integer) -> A` & `[B] (::String) -> B` → `[A] (::Integer | ::String) -> A`)
75
- #
76
- # Otherwise it fails (returns `nil`).
77
- #
78
- def self.intersection: (MethodType type1, MethodType type2, Subtyping::Check) -> MethodType?
79
-
80
- def self.try_type_params: (
81
- MethodType type1,
82
- MethodType type2,
83
- Subtyping::Check,
84
- ^(MethodType, MethodType) -> MethodType?,
85
- ^(MethodType original, MethodType generated) -> Subtyping::Relation[MethodType]
86
- ) -> MethodType?
87
-
88
- # Returns a method type which is a super-type of both self and other.
89
- # self <: (self | other) && other <: (self | other)
90
- #
91
- # * Returns `nil` if self and other are incompatible.
92
- # * Ignores all type parameters.
93
- #
94
- def |: (MethodType other) -> MethodType?
95
-
96
- # Returns a method type which is a sub-type of both self and other.
97
- # (self & other) <: self && (self & other) <: other
98
- #
99
- # * Returns `nil` if self and other are incompatible.
100
- # * Ignores all type parameters.
101
- #
102
- def &: (MethodType other) -> MethodType?
103
- end
104
- end
105
- end
@@ -1,80 +0,0 @@
1
- module Steep
2
- module Interface
3
- class Shape
4
- class Entry
5
- @private_method: bool
6
-
7
- @method_types: Array[MethodType]?
8
-
9
- @generator: (^() -> Array[MethodType]?)?
10
-
11
- def initialize: (method_types: Array[MethodType], private_method: bool) -> void
12
- | (private_method: bool) { () -> Array[MethodType]? } -> void
13
-
14
- def has_method_type?: () -> bool
15
-
16
- def to_s: () -> String
17
-
18
- def private_method?: () -> bool
19
-
20
- def public_method?: () -> bool
21
-
22
- def method_types: () -> Array[MethodType]
23
-
24
- def force: () -> void
25
- end
26
-
27
- class Methods
28
- def []=: (Symbol, Entry) -> Entry
29
-
30
- def []: (Symbol) -> Entry?
31
-
32
- def key?: (Symbol) -> bool
33
-
34
- def each: () { ([Symbol, Entry]) -> void } -> void
35
- | () -> Enumerator[[Symbol, Entry], void]
36
-
37
- def each_name: () { (Symbol) -> void } -> void
38
- | () -> Enumerator[Symbol, void]
39
-
40
- include Enumerable[[Symbol, Entry]]
41
-
42
- attr_reader substs: Array[Substitution]
43
-
44
- attr_reader methods: Hash[Symbol, Entry]
45
- attr_reader resolved_methods: Hash[Symbol, Entry?]
46
-
47
- def initialize: (substs: Array[Substitution], methods: Hash[Symbol, Entry]) -> void
48
-
49
- @subst: Substitution?
50
- def subst: () -> Substitution
51
-
52
- def push_substitution: (Substitution) -> Methods
53
-
54
- def merge!: (Methods other) ?{ (Symbol name, Entry old_entry, Entry new_entry) -> Entry } -> void
55
-
56
- def public_methods: () -> Methods
57
- end
58
-
59
- attr_reader type: AST::Types::t
60
-
61
- attr_reader methods: Methods
62
-
63
- @private: bool
64
-
65
- def initialize: (type: AST::Types::t, private: bool, ?methods: Methods?) -> void
66
-
67
- def update: (?type: AST::Types::t, ?methods: Methods) -> self
68
-
69
- def private?: () -> bool
70
-
71
- def public?: () -> bool
72
-
73
- def subst: (Substitution, ?type: AST::Types::t?) -> Shape
74
-
75
- def public_shape: () -> Shape
76
-
77
- @public_shape: Shape?
78
- end
79
- end
80
- end
@@ -1,51 +0,0 @@
1
- module Steep
2
- module Interface
3
- class Substitution
4
- class InvalidSubstitutionError < StandardError
5
- attr_reader vars_size: Integer
6
-
7
- attr_reader types_size: Integer
8
-
9
- def initialize: (vars_size: Integer, types_size: Integer) -> void
10
- end
11
-
12
- attr_reader dictionary: Hash[Symbol, AST::Types::t]
13
-
14
- attr_reader instance_type: AST::Types::t?
15
-
16
- attr_reader module_type: AST::Types::t?
17
-
18
- attr_reader self_type: AST::Types::t?
19
-
20
- def initialize: (dictionary: Hash[Symbol, AST::Types::t], instance_type: AST::Types::t?, module_type: AST::Types::t?, self_type: AST::Types::t?) -> void
21
-
22
- def self.empty: () -> instance
23
-
24
- def empty?: () -> bool
25
-
26
- def domain: () -> Set[AST::Types::variable]
27
-
28
- def to_s: () -> ::String
29
-
30
- def []: (Symbol key) -> AST::Types::t
31
-
32
- def key?: (Symbol var) -> bool
33
-
34
- def self.build: (Array[Symbol] vars, ?Array[AST::Types::t]? types, ?instance_type: AST::Types::t?, ?module_type: AST::Types::t?, ?self_type: AST::Types::t?) -> Substitution
35
-
36
- def except: (Array[Symbol] vars) -> Substitution
37
-
38
- def except!: (Array[Symbol] vars) -> self
39
-
40
- def merge!: (Substitution s, ?overwrite: bool) -> self
41
-
42
- def merge: (Substitution s) -> Substitution
43
-
44
- def update: (?self_type: AST::Types::t?, ?instance_type: AST::Types::t?, ?module_type: AST::Types::t?) -> Substitution
45
-
46
- def apply?: (AST::Types::t) -> bool
47
-
48
- def add!: (Symbol v, AST::Types::t ty) -> self
49
- end
50
- end
51
- end
@@ -1,43 +0,0 @@
1
- module Steep
2
- module Interface
3
- class TypeParam
4
- type loc = RBS::Location[untyped, untyped]
5
-
6
- type variance = RBS::AST::TypeParam::variance
7
-
8
- attr_reader name: Symbol
9
-
10
- attr_reader upper_bound: AST::Types::t?
11
-
12
- attr_reader variance: variance
13
-
14
- attr_reader unchecked: bool
15
-
16
- attr_reader location: loc?
17
-
18
- def initialize: (name: Symbol, upper_bound: AST::Types::t?, variance: variance, unchecked: bool, ?location: loc?) -> void
19
-
20
- def ==: (untyped other) -> bool
21
-
22
- alias eql? ==
23
-
24
- def hash: () -> Integer
25
-
26
- # Rename the type parameters to fresh names
27
- #
28
- # Returns a pair of renamed type parameters and substitution.
29
- #
30
- # ```rb
31
- # TypeParam.rename([`X`, `Y`], [:X, :Y]) # [[`X(0)`, `Y(1)`], `{ X => X(0), Y => Y(1) }`]
32
- # ```
33
- #
34
- def self.rename: (Array[TypeParam] params, ?Array[Symbol] conflicting_names, ?Array[Symbol] new_names) -> [Array[TypeParam], Substitution]
35
-
36
- def to_s: () -> String
37
-
38
- def update: (?name: Symbol, ?upper_bound: AST::Types::t?, ?variance: variance, ?unchecked: bool, ?location: loc?) -> TypeParam
39
-
40
- def subst: (Substitution s) -> TypeParam
41
- end
42
- end
43
- end
@@ -1,30 +0,0 @@
1
- module Steep
2
- type method_name = InstanceMethodName | SingletonMethodName
3
-
4
- class InstanceMethodName
5
- attr_reader type_name: RBS::TypeName
6
- attr_reader method_name: Symbol
7
-
8
- def initialize: (type_name: RBS::TypeName, method_name: Symbol) -> void
9
-
10
- def relative: () -> InstanceMethodName
11
- end
12
-
13
- class SingletonMethodName
14
- attr_reader type_name: RBS::TypeName
15
- attr_reader method_name: Symbol
16
-
17
- def initialize: (type_name: RBS::TypeName, method_name: Symbol) -> void
18
-
19
- def relative: () -> SingletonMethodName
20
- end
21
-
22
- class ::Object
23
- # Returns method name corresponding to given `string`.
24
- #
25
- # * `ClassName#method_name` syntax returns an `InstanceMethodName` object
26
- # * `ClassName.method_name` syntax returns a `SingletonMethodName` object
27
- #
28
- def MethodName: (String string) -> (InstanceMethodName | SingletonMethodName)
29
- end
30
- end
@@ -1,16 +0,0 @@
1
- module Steep
2
- module ModuleHelper
3
- # Translate a *const* node to a type name if possible
4
- #
5
- # ```ruby
6
- # Foo::Bar # => `Foo::Bar`
7
- # foo::Bar # => nil
8
- # ```
9
- #
10
- def module_name_from_node: (Parser::AST::Node? parent_node, Symbol constant_name) -> RBS::TypeName?
11
-
12
- # Translate a *const* node to a namespace if possible
13
- #
14
- def namespace_from_node: (Parser::AST::Node? node) -> RBS::Namespace?
15
- end
16
- end
@@ -1,91 +0,0 @@
1
- use Parser::AST::Node
2
- use Parser::AST::_Condition, Parser::AST::_Ternary, Parser::AST::_Keyword, Parser::AST::_RescueBody, Parser::AST::_Send
3
- use Parser::Source::Map
4
-
5
- module Steep
6
- module NodeHelper
7
- def each_child_node: (Parser::AST::Node) -> Enumerator[Parser::AST::Node, void]
8
- | (Parser::AST::Node) { (Parser::AST::Node) -> void } -> void
9
-
10
- def each_descendant_node: (Parser::AST::Node) -> Enumerator[Parser::AST::Node, void]
11
- | (Parser::AST::Node) { (Parser::AST::Node) -> void } -> void
12
-
13
- # Returns true if given node is a syntactic-value node
14
- #
15
- def value_node?: (Parser::AST::Node) -> bool
16
-
17
- type condition_loc = Map & _Condition
18
-
19
- type ternary_loc = Map & _Ternary
20
-
21
- def deconstruct_if_node: (Node) -> [Node, Node?, Node?, condition_loc | ternary_loc]?
22
-
23
- def deconstruct_if_node!: (Node) -> [Node, Node?, Node?, condition_loc | ternary_loc]
24
-
25
- def test_if_node: (Node) { (Node, Node?, Node?, condition_loc | ternary_loc) -> bool } -> bool
26
-
27
- type keyword_loc = Map & Parser::AST::_Keyword
28
-
29
- def deconstruct_whileish_node: (Node) -> [Node, Node?, keyword_loc]?
30
-
31
- def deconstruct_whileish_node!: (Node) -> [Node, Node?, keyword_loc]
32
-
33
- def test_whileish_node: (Node) { (Node, Node?, keyword_loc) -> bool } -> bool
34
-
35
- def deconstruct_case_node: (Node) -> [Node?, Array[Node], Node?, condition_loc]?
36
-
37
- def deconstruct_case_node!: (Node) -> [Node?, Array[Node], Node?, condition_loc]
38
-
39
- def test_case_node: (Node) { (Node?, Array[Node], Node?, condition_loc) -> bool } -> bool
40
-
41
- def deconstruct_when_node: (Node) -> [Array[Node], Node?, keyword_loc]?
42
-
43
- def deconstruct_when_node!: (Node) -> [Array[Node], Node?, keyword_loc]
44
-
45
- def test_when_node: (Node) { (Array[Node], Node?, keyword_loc) -> bool } -> bool
46
-
47
- def deconstruct_rescue_node: (Node) -> [Node?, Array[Node], Node?, condition_loc]?
48
-
49
- def deconstruct_rescue_node!: (Node) -> [Node?, Array[Node], Node?, condition_loc]
50
-
51
- def test_rescue_node: (Node) { (Node?, Array[Node], Node?, condition_loc) -> bool } -> bool
52
-
53
- type rescue_body_loc = Map & _RescueBody
54
-
55
- def deconstruct_resbody_node: (Node) -> [Node?, Node?, Node?, rescue_body_loc]?
56
-
57
- def deconstruct_resbody_node!: (Node) -> [Node?, Node?, Node?, rescue_body_loc]
58
-
59
- def test_resbody_node: (Node) { (Node?, Node?, Node?, rescue_body_loc) -> bool } -> bool
60
-
61
- type send_loc = Map & _Send
62
-
63
- def deconstruct_send_node: (Node) -> [Node?, Symbol, Array[Node], send_loc]?
64
-
65
- def deconstruct_send_node!: (Node) -> [Node?, Symbol, Array[Node], send_loc]
66
-
67
- def test_send_node: (Node) { (Node?, Symbol, Array[Node], send_loc) -> bool } -> bool
68
-
69
- # Returns if given node allows calling private method
70
- #
71
- # The node must be:
72
- #
73
- # * A `send` node,
74
- # * A `csend` node,
75
- # * A `block` node, or
76
- # * A `nblock` node
77
- #
78
- def private_send?: (Node) -> bool
79
-
80
- # Deconstruct sendish node and it's associated block node
81
- #
82
- # Receives a sequence of node tree where the leaf node comes first.
83
- # If the first node is `send`, `csend`, `super`, or `zsuper`, it is the sendish node.
84
- #
85
- # If the next node is a `block` or `numblock` that is associated to the *sendish node*, it is the block node.
86
- #
87
- def deconstruct_sendish_and_block_nodes: (*Parser::AST::Node) -> [Parser::AST::Node, Parser::AST::Node?]?
88
-
89
- def clone_node: (Node) -> Node
90
- end
91
- end