steep 1.0.2 → 1.1.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +22 -3
- data/Gemfile +6 -3
- data/Gemfile.lock +12 -16
- data/Gemfile.steep +3 -0
- data/Gemfile.steep.lock +49 -0
- data/Rakefile +5 -0
- data/Steepfile +6 -1
- data/bin/setup +2 -0
- data/bin/steep +19 -0
- data/lib/steep/ast/types/factory.rb +1 -1
- data/lib/steep/diagnostic/ruby.rb +49 -3
- data/lib/steep/diagnostic/signature.rb +18 -0
- data/lib/steep/drivers/watch.rb +3 -1
- data/lib/steep/method_name.rb +9 -3
- data/lib/steep/node_helper.rb +49 -0
- data/lib/steep/services/completion_provider.rb +22 -15
- data/lib/steep/services/hover_provider/ruby.rb +30 -12
- data/lib/steep/services/type_check_service.rb +12 -12
- data/lib/steep/shims/symbol_start_with.rb +18 -0
- data/lib/steep/signature/validator.rb +19 -0
- data/lib/steep/subtyping/constraints.rb +43 -14
- data/lib/steep/type_construction.rb +666 -746
- data/lib/steep/type_inference/constant_env.rb +0 -2
- data/lib/steep/type_inference/context.rb +23 -17
- data/lib/steep/type_inference/logic_type_interpreter.rb +210 -119
- data/lib/steep/type_inference/method_call.rb +80 -6
- data/lib/steep/type_inference/multiple_assignment.rb +189 -0
- data/lib/steep/type_inference/type_env.rb +271 -120
- data/lib/steep/type_inference/type_env_builder.rb +138 -0
- data/lib/steep/typing.rb +2 -0
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +4 -3
- data/rbs_collection.steep.lock.yaml +112 -0
- data/rbs_collection.steep.yaml +19 -0
- data/sample/sig/conference.rbs +8 -0
- data/sig/shims/parser/source/map.rbs +146 -0
- data/sig/shims/parser/source/range.rbs +237 -0
- data/sig/shims/parser.rbs +17 -0
- data/sig/steep/ast/annotation/collection.rbs +75 -0
- data/sig/steep/ast/annotation.rbs +126 -0
- data/sig/steep/ast/builtin.rbs +69 -0
- data/sig/steep/ast/type_params.rbs +11 -0
- data/sig/steep/ast/types/any.rbs +29 -0
- data/sig/steep/ast/types/boolean.rbs +31 -0
- data/sig/steep/ast/types/bot.rbs +29 -0
- data/sig/steep/ast/types/class.rbs +29 -0
- data/sig/steep/ast/types/factory.rbs +76 -0
- data/sig/steep/ast/types/helper.rbs +19 -0
- data/sig/steep/ast/types/instance.rbs +29 -0
- data/sig/steep/ast/types/intersection.rbs +35 -0
- data/sig/steep/ast/types/literal.rbs +33 -0
- data/sig/steep/ast/types/logic.rbs +78 -0
- data/sig/steep/ast/types/name.rbs +71 -0
- data/sig/steep/ast/types/nil.rbs +31 -0
- data/sig/steep/ast/types/proc.rbs +46 -0
- data/sig/steep/ast/types/record.rbs +38 -0
- data/sig/steep/ast/types/self.rbs +29 -0
- data/sig/steep/ast/types/top.rbs +29 -0
- data/sig/steep/ast/types/tuple.rbs +34 -0
- data/sig/steep/ast/types/union.rbs +38 -0
- data/sig/steep/ast/types/var.rbs +37 -0
- data/sig/steep/ast/types/void.rbs +29 -0
- data/sig/steep/ast/types.rbs +37 -0
- data/sig/steep/diagnostic/deprecated/unknown_constant_assigned.rbs +15 -0
- data/sig/steep/diagnostic/helper.rbs +9 -0
- data/sig/steep/diagnostic/lsp_formatter.rbs +29 -0
- data/sig/steep/diagnostic/ruby.rbs +494 -0
- data/sig/steep/diagnostic/signature.rbs +215 -0
- data/sig/steep/interface/block.rbs +35 -0
- data/sig/steep/interface/function.rbs +253 -0
- data/sig/steep/interface/interface.rbs +23 -0
- data/sig/steep/interface/method_type.rbs +55 -0
- data/sig/steep/interface/substitution.rbs +53 -0
- data/sig/steep/interface/type_param.rbs +35 -0
- data/sig/steep/method_name.rbs +26 -0
- data/sig/steep/module_helper.rbs +7 -0
- data/sig/steep/node_helper.rbs +11 -0
- data/sig/steep/project/dsl.rbs +94 -0
- data/sig/steep/project/options.rbs +15 -0
- data/sig/steep/project/pattern.rbs +25 -0
- data/sig/steep/project/target.rbs +25 -0
- data/sig/steep/project.rbs +19 -0
- data/sig/steep/services/completion_provider.rbs +123 -0
- data/sig/steep/services/content_change.rbs +35 -0
- data/sig/steep/services/file_loader.rbs +13 -0
- data/sig/steep/services/goto_service.rbs +45 -0
- data/sig/steep/services/hover_provider/rbs.rbs +21 -0
- data/sig/steep/services/hover_provider/ruby.rbs +109 -0
- data/sig/steep/services/hover_provider/singleton_methods.rbs +11 -0
- data/sig/steep/services/path_assignment.rbs +21 -0
- data/sig/steep/services/signature_service.rbs +91 -0
- data/sig/steep/services/stats_calculator.rbs +17 -0
- data/sig/steep/services/type_check_service.rbs +93 -0
- data/sig/steep/source.rbs +55 -0
- data/sig/steep/subtyping/cache.rbs +17 -0
- data/sig/steep/subtyping/check.rbs +93 -0
- data/sig/steep/subtyping/constraints.rbs +111 -0
- data/sig/steep/subtyping/relation.rbs +51 -0
- data/sig/steep/subtyping/result.rbs +157 -0
- data/sig/steep/subtyping/variable_variance.rbs +23 -0
- data/sig/steep/type_construction.rbs +285 -0
- data/sig/steep/type_inference/block_params.rbs +52 -0
- data/sig/steep/type_inference/constant_env.rbs +27 -0
- data/sig/steep/type_inference/context.rbs +137 -0
- data/sig/steep/type_inference/logic_type_interpreter.rbs +72 -0
- data/sig/steep/type_inference/method_call.rbs +124 -0
- data/sig/steep/type_inference/method_params.rbs +104 -0
- data/sig/steep/type_inference/multiple_assignment.rbs +76 -0
- data/sig/steep/type_inference/type_env.rbs +158 -0
- data/sig/steep/type_inference/type_env_builder.rbs +77 -0
- data/sig/steep/typing.rbs +68 -0
- data/sig/steep.rbs +31 -0
- data/smoke/class/f.rb +1 -0
- data/smoke/class/test_expectations.yml +2 -2
- data/smoke/diagnostics/test_expectations.yml +4 -2
- metadata +90 -6
- data/lib/steep/type_inference/local_variable_type_env.rb +0 -249
- data/lib/steep/type_inference/logic.rb +0 -161
@@ -0,0 +1,35 @@
|
|
1
|
+
module Steep
|
2
|
+
module Interface
|
3
|
+
class Block
|
4
|
+
attr_reader type: Function
|
5
|
+
|
6
|
+
attr_reader optional: bool
|
7
|
+
|
8
|
+
def initialize: (type: Function, optional: bool) -> void
|
9
|
+
|
10
|
+
def optional?: () -> bool
|
11
|
+
|
12
|
+
def required?: () -> bool
|
13
|
+
|
14
|
+
def to_optional: () -> Block
|
15
|
+
|
16
|
+
def ==: (untyped other) -> bool
|
17
|
+
|
18
|
+
alias eql? ==
|
19
|
+
|
20
|
+
def hash: () -> Integer
|
21
|
+
|
22
|
+
def closed?: () -> bool
|
23
|
+
|
24
|
+
def subst: (Substitution s) -> Block
|
25
|
+
|
26
|
+
def free_variables: () -> Set[Symbol]
|
27
|
+
|
28
|
+
def to_s: () -> ::String
|
29
|
+
|
30
|
+
def map_type: () { (AST::Types::t) -> AST::Types::t } -> Block
|
31
|
+
|
32
|
+
def +: (Block other) -> Block
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,253 @@
|
|
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
|
+
class PositionalParams
|
12
|
+
class Base
|
13
|
+
attr_reader type: untyped
|
14
|
+
|
15
|
+
def initialize: (untyped `type`) -> void
|
16
|
+
|
17
|
+
def ==: (untyped other) -> untyped
|
18
|
+
|
19
|
+
alias eql? ==
|
20
|
+
|
21
|
+
def hash: () -> untyped
|
22
|
+
|
23
|
+
def subst: (untyped s) -> untyped
|
24
|
+
|
25
|
+
def var_type: () -> untyped
|
26
|
+
|
27
|
+
def map_type: () { (untyped) -> untyped } -> untyped
|
28
|
+
end
|
29
|
+
|
30
|
+
class Required < Base
|
31
|
+
end
|
32
|
+
|
33
|
+
class Optional < Base
|
34
|
+
end
|
35
|
+
|
36
|
+
class Rest < Base
|
37
|
+
end
|
38
|
+
|
39
|
+
attr_reader head: untyped
|
40
|
+
|
41
|
+
attr_reader tail: untyped
|
42
|
+
|
43
|
+
def initialize: (head: untyped, tail: untyped) -> void
|
44
|
+
|
45
|
+
def self.required: (untyped `type`, ?untyped? tail) -> untyped
|
46
|
+
|
47
|
+
def self.optional: (untyped `type`, ?untyped? tail) -> untyped
|
48
|
+
|
49
|
+
def self.rest: (untyped `type`, ?untyped? tail) -> untyped
|
50
|
+
|
51
|
+
def to_ary: () -> ::Array[untyped]
|
52
|
+
|
53
|
+
def map: () { (untyped) -> untyped } -> untyped
|
54
|
+
|
55
|
+
def map_type: () { () -> untyped } -> untyped
|
56
|
+
|
57
|
+
def subst: (untyped s) -> untyped
|
58
|
+
|
59
|
+
def ==: (untyped other) -> untyped
|
60
|
+
|
61
|
+
alias eql? ==
|
62
|
+
|
63
|
+
def hash: () -> untyped
|
64
|
+
|
65
|
+
def each: () { (untyped) -> untyped } -> untyped
|
66
|
+
|
67
|
+
def each_type: () { (untyped) -> untyped } -> untyped
|
68
|
+
|
69
|
+
def size: () -> untyped
|
70
|
+
|
71
|
+
def self.build: (required: untyped, optional: untyped, rest: untyped) -> untyped
|
72
|
+
|
73
|
+
extend Utils
|
74
|
+
|
75
|
+
# Calculates xs + ys.
|
76
|
+
# Never fails.
|
77
|
+
def self.merge_for_overload: (untyped xs, untyped ys) -> untyped
|
78
|
+
|
79
|
+
# xs | ys
|
80
|
+
def self.merge_for_union: (untyped xs, untyped ys) -> untyped
|
81
|
+
|
82
|
+
# Calculates xs & ys.
|
83
|
+
# Raises when failed.
|
84
|
+
#
|
85
|
+
def self.merge_for_intersection: (untyped xs, untyped ys) -> untyped
|
86
|
+
end
|
87
|
+
|
88
|
+
class KeywordParams
|
89
|
+
attr_reader requireds: untyped
|
90
|
+
|
91
|
+
attr_reader optionals: untyped
|
92
|
+
|
93
|
+
attr_reader rest: untyped
|
94
|
+
|
95
|
+
def initialize: (?requireds: ::Hash[untyped, untyped], ?optionals: ::Hash[untyped, untyped], ?rest: untyped?) -> void
|
96
|
+
|
97
|
+
def ==: (untyped other) -> untyped
|
98
|
+
|
99
|
+
alias eql? ==
|
100
|
+
|
101
|
+
def hash: () -> untyped
|
102
|
+
|
103
|
+
def update: (?requireds: untyped, ?optionals: untyped, ?rest: untyped) -> untyped
|
104
|
+
|
105
|
+
def empty?: () -> untyped
|
106
|
+
|
107
|
+
def each: () { (untyped, untyped) -> untyped } -> untyped
|
108
|
+
|
109
|
+
def each_type: () { (untyped) -> untyped } -> untyped
|
110
|
+
|
111
|
+
def map_type: () { () -> untyped } -> untyped
|
112
|
+
|
113
|
+
def subst: (untyped s) -> untyped
|
114
|
+
|
115
|
+
def size: () -> untyped
|
116
|
+
|
117
|
+
def keywords: () -> untyped
|
118
|
+
|
119
|
+
include Utils
|
120
|
+
|
121
|
+
# For overloading
|
122
|
+
def +: (untyped other) -> untyped
|
123
|
+
|
124
|
+
# For union
|
125
|
+
def |: (untyped other) -> untyped
|
126
|
+
|
127
|
+
# For intersection
|
128
|
+
def &: (untyped other) -> (nil | untyped)
|
129
|
+
end
|
130
|
+
|
131
|
+
def required: () -> Array[AST::Types::t]
|
132
|
+
|
133
|
+
def optional: () -> Array[AST::Types::t]
|
134
|
+
|
135
|
+
def rest: () -> AST::Types::t?
|
136
|
+
|
137
|
+
attr_reader positional_params: PositionalParams
|
138
|
+
|
139
|
+
attr_reader keyword_params: KeywordParams
|
140
|
+
|
141
|
+
def self.build: (?required: untyped, ?optional: untyped, ?rest: untyped?, ?required_keywords: ::Hash[untyped, untyped], ?optional_keywords: ::Hash[untyped, untyped], ?rest_keywords: untyped?) -> untyped
|
142
|
+
|
143
|
+
def initialize: (positional_params: untyped, keyword_params: untyped) -> void
|
144
|
+
|
145
|
+
def update: (?positional_params: untyped, ?keyword_params: untyped) -> untyped
|
146
|
+
|
147
|
+
def first_param: () -> untyped
|
148
|
+
|
149
|
+
def with_first_param: (untyped param) -> untyped
|
150
|
+
|
151
|
+
def has_positional?: () -> (true | false)
|
152
|
+
|
153
|
+
def self.empty: () -> untyped
|
154
|
+
|
155
|
+
def ==: (untyped other) -> untyped
|
156
|
+
|
157
|
+
alias eql? ==
|
158
|
+
|
159
|
+
def hash: () -> untyped
|
160
|
+
|
161
|
+
def flat_unnamed_params: () -> (untyped | ::Array[untyped])
|
162
|
+
|
163
|
+
def flat_keywords: () -> untyped
|
164
|
+
|
165
|
+
def required_keywords: () -> untyped
|
166
|
+
|
167
|
+
def optional_keywords: () -> untyped
|
168
|
+
|
169
|
+
def rest_keywords: () -> untyped
|
170
|
+
|
171
|
+
def has_keywords?: () -> untyped
|
172
|
+
|
173
|
+
def each_positional_param: () { () -> untyped } -> (untyped | nil | untyped)
|
174
|
+
|
175
|
+
def without_keywords: () -> untyped
|
176
|
+
|
177
|
+
def drop_first: () -> untyped
|
178
|
+
|
179
|
+
def each_type: () { () -> untyped } -> untyped
|
180
|
+
|
181
|
+
def free_variables: () -> untyped
|
182
|
+
|
183
|
+
def closed?: () -> untyped
|
184
|
+
|
185
|
+
def subst: (untyped s) -> untyped
|
186
|
+
|
187
|
+
def size: () -> untyped
|
188
|
+
|
189
|
+
def to_s: () -> ::String
|
190
|
+
|
191
|
+
def map_type: () { () -> untyped } -> untyped
|
192
|
+
|
193
|
+
def empty?: () -> untyped
|
194
|
+
|
195
|
+
# Returns true if all arguments are non-required.
|
196
|
+
def optional?: () -> untyped
|
197
|
+
|
198
|
+
# self + params returns a new params for overloading.
|
199
|
+
#
|
200
|
+
def +: (untyped other) -> untyped
|
201
|
+
|
202
|
+
# Returns the intersection between self and other.
|
203
|
+
# Returns nil if the intersection cannot be computed.
|
204
|
+
#
|
205
|
+
# (self & other) <: self
|
206
|
+
# (self & other) <: other
|
207
|
+
#
|
208
|
+
# `self & other` accept `arg` if `arg` is acceptable for both of `self` and `other`.
|
209
|
+
#
|
210
|
+
def &: (untyped other) -> (nil | untyped)
|
211
|
+
|
212
|
+
# Returns the union between self and other.
|
213
|
+
#
|
214
|
+
# self <: (self | other)
|
215
|
+
# other <: (self | other)
|
216
|
+
#
|
217
|
+
# `self | other` accept `arg` if `self` accepts `arg` or `other` accepts `arg`.
|
218
|
+
#
|
219
|
+
def |: (untyped other) -> (nil | untyped)
|
220
|
+
end
|
221
|
+
|
222
|
+
attr_reader params: untyped
|
223
|
+
|
224
|
+
attr_reader return_type: AST::Types::t
|
225
|
+
|
226
|
+
attr_reader location: untyped
|
227
|
+
|
228
|
+
def initialize: (params: untyped, return_type: untyped, location: untyped) -> void
|
229
|
+
|
230
|
+
def ==: (untyped other) -> untyped
|
231
|
+
|
232
|
+
alias eql? ==
|
233
|
+
|
234
|
+
def hash: () -> untyped
|
235
|
+
|
236
|
+
def free_variables: () -> Set[Symbol]
|
237
|
+
|
238
|
+
def subst: (Substitution s) -> Function
|
239
|
+
|
240
|
+
def each_child: () { () -> untyped } -> untyped
|
241
|
+
|
242
|
+
def each_type: () { (untyped) -> untyped } -> untyped
|
243
|
+
|
244
|
+
def map_type: () { (untyped) -> untyped } -> untyped
|
245
|
+
|
246
|
+
def with: (?params: untyped, ?return_type: untyped) -> untyped
|
247
|
+
|
248
|
+
def to_s: () -> ::String
|
249
|
+
|
250
|
+
def closed?: () -> bool
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Steep
|
2
|
+
module Interface
|
3
|
+
class Interface
|
4
|
+
class Entry
|
5
|
+
attr_reader method_types: untyped
|
6
|
+
|
7
|
+
def initialize: (method_types: untyped) -> void
|
8
|
+
|
9
|
+
def to_s: () -> ::String
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader type: untyped
|
13
|
+
|
14
|
+
attr_reader methods: untyped
|
15
|
+
|
16
|
+
def initialize: (type: untyped, private: untyped) -> void
|
17
|
+
|
18
|
+
def private?: () -> untyped
|
19
|
+
|
20
|
+
def public?: () -> untyped
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Steep
|
2
|
+
module Interface
|
3
|
+
class MethodType
|
4
|
+
attr_reader type_params: Array[TypeParam]
|
5
|
+
|
6
|
+
attr_reader type: Function
|
7
|
+
|
8
|
+
attr_reader block: Block
|
9
|
+
|
10
|
+
attr_reader method_decls: untyped
|
11
|
+
|
12
|
+
def initialize: (type_params: untyped, type: untyped, block: untyped, method_decls: untyped) -> void
|
13
|
+
|
14
|
+
def ==: (untyped other) -> untyped
|
15
|
+
|
16
|
+
alias eql? ==
|
17
|
+
|
18
|
+
def hash: () -> Integer
|
19
|
+
|
20
|
+
def free_variables: () -> Set[Symbol]
|
21
|
+
|
22
|
+
def subst: (Substitution s) -> MethodType
|
23
|
+
|
24
|
+
def each_type: () { (untyped) -> untyped } -> untyped
|
25
|
+
|
26
|
+
def instantiate: (Substitution s) -> MethodType
|
27
|
+
|
28
|
+
def with: (?type_params: untyped, ?type: untyped, ?block: untyped, ?method_decls: untyped) -> MethodType
|
29
|
+
|
30
|
+
def to_s: () -> ::String
|
31
|
+
|
32
|
+
def map_type: () { (AST::Types::t) -> AST::Types::t } -> MethodType
|
33
|
+
|
34
|
+
# Returns a new method type which can be used for the method implementation type of both `self` and `other`.
|
35
|
+
#
|
36
|
+
def unify_overload: (untyped other) -> untyped
|
37
|
+
|
38
|
+
def +: (untyped other) -> untyped
|
39
|
+
|
40
|
+
# Returns a method type which is a super-type of both self and other.
|
41
|
+
# self <: (self | other) && other <: (self | other)
|
42
|
+
#
|
43
|
+
# Returns nil if self and other are incompatible.
|
44
|
+
#
|
45
|
+
def |: (untyped other) -> (nil | untyped)
|
46
|
+
|
47
|
+
# Returns a method type which is a sub-type of both self and other.
|
48
|
+
# (self & other) <: self && (self & other) <: other
|
49
|
+
#
|
50
|
+
# Returns nil if self and other are incompatible.
|
51
|
+
#
|
52
|
+
def &: (untyped other) -> (nil | untyped)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Steep
|
2
|
+
module Interface
|
3
|
+
class Substitution
|
4
|
+
class InvalidSubstitutionError < StandardError
|
5
|
+
attr_reader vars_size: untyped
|
6
|
+
|
7
|
+
attr_reader types_size: untyped
|
8
|
+
|
9
|
+
def initialize: (vars_size: untyped, types_size: untyped) -> void
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader dictionary: untyped
|
13
|
+
|
14
|
+
attr_reader instance_type: untyped
|
15
|
+
|
16
|
+
attr_reader module_type: untyped
|
17
|
+
|
18
|
+
attr_reader self_type: untyped
|
19
|
+
|
20
|
+
def initialize: (dictionary: untyped, instance_type: untyped, module_type: untyped, self_type: untyped) -> void
|
21
|
+
|
22
|
+
def self.empty: () -> untyped
|
23
|
+
|
24
|
+
def empty?: () -> untyped
|
25
|
+
|
26
|
+
INSTANCE_TYPE: untyped
|
27
|
+
|
28
|
+
CLASS_TYPE: untyped
|
29
|
+
|
30
|
+
SELF_TYPE: untyped
|
31
|
+
|
32
|
+
def domain: () -> untyped
|
33
|
+
|
34
|
+
def to_s: () -> ::String
|
35
|
+
|
36
|
+
def []: (untyped key) -> untyped
|
37
|
+
|
38
|
+
def key?: (untyped var) -> untyped
|
39
|
+
|
40
|
+
def self.build: (untyped vars, ?untyped? types, ?instance_type: untyped, ?module_type: untyped, ?self_type: untyped) -> Substitution
|
41
|
+
|
42
|
+
def except: (untyped vars) -> untyped
|
43
|
+
|
44
|
+
def except!: (untyped vars) -> self
|
45
|
+
|
46
|
+
def merge!: (untyped s, ?overwrite: bool) -> self
|
47
|
+
|
48
|
+
def merge: (untyped s) -> untyped
|
49
|
+
|
50
|
+
def add!: (untyped v, untyped ty) -> untyped
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,35 @@
|
|
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
|
+
def self.rename: (Array[TypeParam] params, ?Array[Symbol] conflicting_names) -> [Array[TypeParam], Substitution]
|
27
|
+
|
28
|
+
def to_s: () -> String
|
29
|
+
|
30
|
+
def update: (?name: Symbol, ?upper_bound: AST::Types::t?, ?variance: variance, ?unchecked: bool, ?location: loc?) -> TypeParam
|
31
|
+
|
32
|
+
def subst: (Substitution s) -> TypeParam
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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
|
+
end
|
10
|
+
|
11
|
+
class SingletonMethodName
|
12
|
+
attr_reader type_name: RBS::TypeName
|
13
|
+
attr_reader method_name: Symbol
|
14
|
+
|
15
|
+
def initialize: (type_name: RBS::TypeName, method_name: Symbol) -> void
|
16
|
+
end
|
17
|
+
|
18
|
+
class ::Object
|
19
|
+
# Returns method name corresponding to given `string`.
|
20
|
+
#
|
21
|
+
# * `ClassName#method_name` syntax returns an `InstanceMethodName` object
|
22
|
+
# * `ClassName.method_name` syntax returns a `SingletonMethodName` object
|
23
|
+
#
|
24
|
+
def MethodName: (String string) -> (InstanceMethodName | SingletonMethodName)
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Steep
|
2
|
+
module NodeHelper
|
3
|
+
def each_child_node: (Parser::AST::Node) -> Enumerator[Parser::AST::Node, void]
|
4
|
+
| (Parser::AST::Node) { (Parser::AST::Node) -> void } -> void
|
5
|
+
|
6
|
+
def each_descendant_node: (Parser::AST::Node) -> Enumerator[Parser::AST::Node, void]
|
7
|
+
| (Parser::AST::Node) { (Parser::AST::Node) -> void } -> void
|
8
|
+
|
9
|
+
def value_node?: (Parser::AST::Node) -> bool
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module Steep
|
2
|
+
class Project
|
3
|
+
class DSL
|
4
|
+
class TargetDSL
|
5
|
+
attr_reader name: untyped
|
6
|
+
|
7
|
+
attr_reader sources: untyped
|
8
|
+
|
9
|
+
attr_reader libraries: untyped
|
10
|
+
|
11
|
+
attr_reader signatures: untyped
|
12
|
+
|
13
|
+
attr_reader ignored_sources: untyped
|
14
|
+
|
15
|
+
attr_reader stdlib_root: untyped
|
16
|
+
|
17
|
+
attr_reader core_root: untyped
|
18
|
+
|
19
|
+
attr_reader repo_paths: untyped
|
20
|
+
|
21
|
+
attr_reader code_diagnostics_config: untyped
|
22
|
+
|
23
|
+
attr_reader project: untyped
|
24
|
+
|
25
|
+
attr_reader collection_config_path: untyped
|
26
|
+
|
27
|
+
NONE: untyped
|
28
|
+
|
29
|
+
def initialize: (untyped name, ?sources: untyped, ?libraries: untyped, ?signatures: untyped, ?ignored_sources: untyped, ?repo_paths: untyped, ?code_diagnostics_config: ::Hash[untyped, untyped], ?project: untyped?, ?collection_config_path: untyped) -> void
|
30
|
+
|
31
|
+
def initialize_copy: (untyped other) -> untyped
|
32
|
+
|
33
|
+
def check: (*untyped args) -> untyped
|
34
|
+
|
35
|
+
def ignore: (*untyped args) -> untyped
|
36
|
+
|
37
|
+
def library: (*untyped args) -> untyped
|
38
|
+
|
39
|
+
def typing_options: (?untyped? level, **untyped hash) -> untyped
|
40
|
+
|
41
|
+
def signature: (*untyped args) -> untyped
|
42
|
+
|
43
|
+
def update: (?name: untyped, ?sources: untyped, ?libraries: untyped, ?ignored_sources: untyped, ?signatures: untyped, ?project: untyped) -> untyped
|
44
|
+
|
45
|
+
def no_builtin!: (?bool value) -> untyped
|
46
|
+
|
47
|
+
def vendor: (?::String dir, ?stdlib: untyped?, ?gems: untyped?) -> untyped
|
48
|
+
|
49
|
+
def stdlib_path: (core_root: untyped, stdlib_root: untyped) -> untyped
|
50
|
+
|
51
|
+
def repo_path: (*untyped paths) -> untyped
|
52
|
+
|
53
|
+
# Configure the code diagnostics printing setup.
|
54
|
+
#
|
55
|
+
# Yields a hash, and the update the hash in the block.
|
56
|
+
#
|
57
|
+
# ```rb
|
58
|
+
# D = Steep::Diagnostic
|
59
|
+
#
|
60
|
+
# configure_code_diagnostics do |hash|
|
61
|
+
# # Assign one of :error, :warning, :information, :hint or :nil to error classes.
|
62
|
+
# hash[D::Ruby::UnexpectedPositionalArgument] = :error
|
63
|
+
# end
|
64
|
+
# ```
|
65
|
+
#
|
66
|
+
# Passing a hash is also allowed.
|
67
|
+
#
|
68
|
+
# ```rb
|
69
|
+
# D = Steep::Diagnostic
|
70
|
+
#
|
71
|
+
# configure_code_diagnostics(D::Ruby.lenient)
|
72
|
+
# ```
|
73
|
+
#
|
74
|
+
def configure_code_diagnostics: (?untyped? hash) { (untyped) -> untyped } -> untyped
|
75
|
+
|
76
|
+
def collection_config: (untyped path) -> untyped
|
77
|
+
|
78
|
+
def disable_collection: () -> untyped
|
79
|
+
end
|
80
|
+
|
81
|
+
attr_reader project: untyped
|
82
|
+
|
83
|
+
def self.templates: () -> untyped
|
84
|
+
|
85
|
+
def initialize: (project: untyped) -> void
|
86
|
+
|
87
|
+
def self.register_template: (untyped name, untyped target) -> untyped
|
88
|
+
|
89
|
+
def self.parse: (untyped project, untyped code, ?filename: ::String) -> untyped
|
90
|
+
|
91
|
+
def target: (untyped name, ?template: untyped?) ?{ () -> untyped } -> untyped
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Steep
|
2
|
+
class Project
|
3
|
+
class Pattern
|
4
|
+
attr_reader patterns: untyped
|
5
|
+
|
6
|
+
attr_reader ignores: untyped
|
7
|
+
|
8
|
+
attr_reader prefixes: untyped
|
9
|
+
|
10
|
+
attr_reader ignore_prefixes: untyped
|
11
|
+
|
12
|
+
attr_reader ext: untyped
|
13
|
+
|
14
|
+
def initialize: (patterns: untyped, ext: untyped, ?ignores: untyped) -> void
|
15
|
+
|
16
|
+
def =~: (untyped path) -> untyped
|
17
|
+
|
18
|
+
def match?: (untyped path) -> untyped
|
19
|
+
|
20
|
+
def ignore?: (untyped path) -> untyped
|
21
|
+
|
22
|
+
def test_string: (untyped path, untyped patterns, untyped prefixes) -> untyped
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Steep
|
2
|
+
class Project
|
3
|
+
class Target
|
4
|
+
attr_reader name: untyped
|
5
|
+
|
6
|
+
attr_reader options: untyped
|
7
|
+
|
8
|
+
attr_reader source_pattern: untyped
|
9
|
+
|
10
|
+
attr_reader signature_pattern: untyped
|
11
|
+
|
12
|
+
attr_reader code_diagnostics_config: untyped
|
13
|
+
|
14
|
+
def initialize: (name: untyped, options: untyped, source_pattern: untyped, signature_pattern: untyped, code_diagnostics_config: untyped) -> void
|
15
|
+
|
16
|
+
def possible_source_file?: (untyped path) -> untyped
|
17
|
+
|
18
|
+
def possible_signature_file?: (untyped path) -> untyped
|
19
|
+
|
20
|
+
def new_env_loader: (project: untyped) -> untyped
|
21
|
+
|
22
|
+
def self.construct_env_loader: (options: untyped, project: untyped) -> untyped
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Steep
|
2
|
+
class Project
|
3
|
+
attr_reader targets: untyped
|
4
|
+
|
5
|
+
attr_reader steepfile_path: untyped
|
6
|
+
|
7
|
+
def initialize: (steepfile_path: untyped) -> void
|
8
|
+
|
9
|
+
def base_dir: () -> untyped
|
10
|
+
|
11
|
+
def relative_path: (untyped path) -> untyped
|
12
|
+
|
13
|
+
def absolute_path: (untyped path) -> untyped
|
14
|
+
|
15
|
+
def target_for_source_path: (untyped path) -> untyped
|
16
|
+
|
17
|
+
def targets_for_path: (untyped path) -> (::Array[untyped | ::Array[untyped]] | ::Array[nil | untyped])
|
18
|
+
end
|
19
|
+
end
|