steep 1.0.0 → 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-windows.yml +34 -0
- data/.github/workflows/ruby.yml +7 -2
- data/.gitignore +1 -0
- data/CHANGELOG.md +59 -0
- data/Gemfile +7 -4
- data/Gemfile.lock +17 -21
- 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/builtin.rb +2 -2
- data/lib/steep/ast/types/factory.rb +7 -3
- data/lib/steep/ast/types/proc.rb +2 -0
- data/lib/steep/cli.rb +3 -1
- data/lib/steep/diagnostic/ruby.rb +50 -4
- data/lib/steep/diagnostic/signature.rb +18 -0
- data/lib/steep/drivers/check.rb +3 -3
- 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/path_helper.rb +22 -0
- data/lib/steep/project.rb +3 -15
- data/lib/steep/server/base_worker.rb +1 -0
- data/lib/steep/server/change_buffer.rb +1 -1
- data/lib/steep/server/interaction_worker.rb +3 -5
- data/lib/steep/server/master.rb +61 -45
- data/lib/steep/server/type_check_worker.rb +10 -25
- data/lib/steep/services/completion_provider.rb +25 -18
- data/lib/steep/services/goto_service.rb +2 -4
- data/lib/steep/services/hover_provider/rbs.rb +1 -1
- data/lib/steep/services/hover_provider/ruby.rb +30 -12
- data/lib/steep/services/stats_calculator.rb +0 -1
- data/lib/steep/services/type_check_service.rb +15 -12
- data/lib/steep/shims/symbol_start_with.rb +18 -0
- data/lib/steep/signature/validator.rb +25 -1
- data/lib/steep/source.rb +1 -1
- data/lib/steep/subtyping/check.rb +0 -3
- data/lib/steep/subtyping/constraints.rb +43 -14
- data/lib/steep/type_construction.rb +721 -764
- 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 -117
- 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/send_args.rb +1 -2
- data/lib/steep/type_inference/type_env.rb +273 -116
- 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 +7 -5
- 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
- data/smoke/regression/lambda.rb +3 -0
- data/smoke/regression/test_expectations.yml +12 -0
- data/steep.gemspec +1 -1
- metadata +95 -9
- data/lib/steep/subtyping/variable_occurrence.rb +0 -51
- data/lib/steep/type_inference/local_variable_type_env.rb +0 -249
- data/lib/steep/type_inference/logic.rb +0 -161
@@ -0,0 +1,237 @@
|
|
1
|
+
module Parser
|
2
|
+
module Source
|
3
|
+
#
|
4
|
+
# A range of characters in a particular source buffer.
|
5
|
+
#
|
6
|
+
# The range is always exclusive, i.e. a range with `begin_pos` of 3 and
|
7
|
+
# `end_pos` of 5 will contain the following characters:
|
8
|
+
#
|
9
|
+
# example
|
10
|
+
# ^^
|
11
|
+
#
|
12
|
+
# @!attribute [r] source_buffer
|
13
|
+
# @return [Parser::Source::Buffer]
|
14
|
+
#
|
15
|
+
# @!attribute [r] begin_pos
|
16
|
+
# @return [Integer] index of the first character in the range
|
17
|
+
#
|
18
|
+
# @!attribute [r] end_pos
|
19
|
+
# @return [Integer] index of the character after the last character in the range
|
20
|
+
#
|
21
|
+
# @api public
|
22
|
+
#
|
23
|
+
class Range
|
24
|
+
include Comparable
|
25
|
+
|
26
|
+
attr_reader source_buffer: untyped
|
27
|
+
|
28
|
+
attr_reader begin_pos: Integer
|
29
|
+
|
30
|
+
attr_reader end_pos: Integer
|
31
|
+
|
32
|
+
#
|
33
|
+
# @param [Buffer] source_buffer
|
34
|
+
# @param [Integer] begin_pos
|
35
|
+
# @param [Integer] end_pos
|
36
|
+
#
|
37
|
+
def initialize: (untyped source_buffer, untyped begin_pos, untyped end_pos) -> void
|
38
|
+
|
39
|
+
#
|
40
|
+
# @return [Range] a zero-length range located just before the beginning
|
41
|
+
# of this range.
|
42
|
+
#
|
43
|
+
def begin: () -> Range
|
44
|
+
|
45
|
+
#
|
46
|
+
# @return [Range] a zero-length range located just after the end
|
47
|
+
# of this range.
|
48
|
+
#
|
49
|
+
def end: () -> Range
|
50
|
+
|
51
|
+
#
|
52
|
+
# @return [Integer] amount of characters included in this range.
|
53
|
+
#
|
54
|
+
def size: () -> Integer
|
55
|
+
|
56
|
+
alias length size
|
57
|
+
|
58
|
+
#
|
59
|
+
# Line number of the beginning of this range. By default, the first line
|
60
|
+
# of a buffer is 1; as such, line numbers are most commonly one-based.
|
61
|
+
#
|
62
|
+
# @see Buffer
|
63
|
+
# @return [Integer] line number of the beginning of this range.
|
64
|
+
#
|
65
|
+
def line: () -> Integer
|
66
|
+
|
67
|
+
alias first_line line
|
68
|
+
|
69
|
+
#
|
70
|
+
# @return [Integer] zero-based column number of the beginning of this range.
|
71
|
+
#
|
72
|
+
def column: () -> Integer
|
73
|
+
|
74
|
+
#
|
75
|
+
# @return [Integer] line number of the end of this range.
|
76
|
+
#
|
77
|
+
def last_line: () -> Integer
|
78
|
+
|
79
|
+
#
|
80
|
+
# @return [Integer] zero-based column number of the end of this range.
|
81
|
+
#
|
82
|
+
def last_column: () -> Integer
|
83
|
+
|
84
|
+
#
|
85
|
+
# @return [::Range] a range of columns spanned by this range.
|
86
|
+
# @raise RangeError
|
87
|
+
#
|
88
|
+
def column_range: () -> ::Range[Integer]
|
89
|
+
|
90
|
+
#
|
91
|
+
# @return [String] a line of source code containing the beginning of this range.
|
92
|
+
#
|
93
|
+
def source_line: () -> String
|
94
|
+
|
95
|
+
#
|
96
|
+
# @return [String] all source code covered by this range.
|
97
|
+
#
|
98
|
+
def source: () -> String
|
99
|
+
|
100
|
+
#
|
101
|
+
# `is?` provides a concise way to compare the source corresponding to this range.
|
102
|
+
# For example, `r.source == '(' || r.source == 'begin'` is equivalent to
|
103
|
+
# `r.is?('(', 'begin')`.
|
104
|
+
#
|
105
|
+
def is?: (*untyped what) -> untyped
|
106
|
+
|
107
|
+
#
|
108
|
+
# @return [Array<Integer>] a set of character indexes contained in this range.
|
109
|
+
#
|
110
|
+
def to_a: () -> Array[Integer]
|
111
|
+
|
112
|
+
#
|
113
|
+
# @return [Range] a Ruby range with the same `begin_pos` and `end_pos`
|
114
|
+
#
|
115
|
+
def to_range: () -> ::Range[Integer]
|
116
|
+
|
117
|
+
#
|
118
|
+
# Composes a GNU/Clang-style string representation of the beginning of this
|
119
|
+
# range.
|
120
|
+
#
|
121
|
+
# For example, for the following range in file `foo.rb`,
|
122
|
+
#
|
123
|
+
# def foo
|
124
|
+
# ^^^
|
125
|
+
#
|
126
|
+
# `to_s` will return `foo.rb:1:5`.
|
127
|
+
# Note that the column index is one-based.
|
128
|
+
#
|
129
|
+
# @return [String]
|
130
|
+
#
|
131
|
+
def to_s: () -> String
|
132
|
+
|
133
|
+
#
|
134
|
+
# @param [Hash] Endpoint(s) to change, any combination of :begin_pos or :end_pos
|
135
|
+
# @return [Range] the same range as this range but with the given end point(s) changed
|
136
|
+
# to the given value(s).
|
137
|
+
#
|
138
|
+
def with: (?begin_pos: untyped, ?end_pos: untyped) -> untyped
|
139
|
+
|
140
|
+
#
|
141
|
+
# @param [Hash] Endpoint(s) to change, any combination of :begin_pos or :end_pos
|
142
|
+
# @return [Range] the same range as this range but with the given end point(s) adjusted
|
143
|
+
# by the given amount(s)
|
144
|
+
#
|
145
|
+
def adjust: (?begin_pos: ::Integer, ?end_pos: ::Integer) -> untyped
|
146
|
+
|
147
|
+
#
|
148
|
+
# @param [Integer] new_size
|
149
|
+
# @return [Range] a range beginning at the same point as this range and length `new_size`.
|
150
|
+
#
|
151
|
+
def resize: (untyped new_size) -> untyped
|
152
|
+
|
153
|
+
#
|
154
|
+
# @param [Range] other
|
155
|
+
# @return [Range] smallest possible range spanning both this range and `other`.
|
156
|
+
#
|
157
|
+
def join: (untyped other) -> untyped
|
158
|
+
|
159
|
+
#
|
160
|
+
# @param [Range] other
|
161
|
+
# @return [Range] overlapping region of this range and `other`, or `nil`
|
162
|
+
# if they do not overlap
|
163
|
+
#
|
164
|
+
def intersect: (untyped other) -> (untyped | nil)
|
165
|
+
|
166
|
+
#
|
167
|
+
# Return `true` iff this range and `other` are disjoint.
|
168
|
+
#
|
169
|
+
# Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
|
170
|
+
#
|
171
|
+
# @param [Range] other
|
172
|
+
# @return [Boolean]
|
173
|
+
#
|
174
|
+
def disjoint?: (untyped other) -> untyped
|
175
|
+
|
176
|
+
#
|
177
|
+
# Return `true` iff this range is not disjoint from `other`.
|
178
|
+
#
|
179
|
+
# @param [Range] other
|
180
|
+
# @return [Boolean] `true` if this range and `other` overlap
|
181
|
+
#
|
182
|
+
def overlaps?: (untyped other) -> untyped
|
183
|
+
|
184
|
+
#
|
185
|
+
# Returns true iff this range contains (strictly) `other`.
|
186
|
+
#
|
187
|
+
# Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
|
188
|
+
#
|
189
|
+
# @param [Range] other
|
190
|
+
# @return [Boolean]
|
191
|
+
#
|
192
|
+
def contains?: (untyped other) -> untyped
|
193
|
+
|
194
|
+
#
|
195
|
+
# Return `other.contains?(self)`
|
196
|
+
#
|
197
|
+
# Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
|
198
|
+
#
|
199
|
+
# @param [Range] other
|
200
|
+
# @return [Boolean]
|
201
|
+
#
|
202
|
+
def contained?: (untyped other) -> untyped
|
203
|
+
|
204
|
+
#
|
205
|
+
# Returns true iff both ranges intersect and also have different elements from one another.
|
206
|
+
#
|
207
|
+
# Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
|
208
|
+
#
|
209
|
+
# @param [Range] other
|
210
|
+
# @return [Boolean]
|
211
|
+
#
|
212
|
+
def crossing?: (untyped other) -> (false | untyped)
|
213
|
+
|
214
|
+
#
|
215
|
+
# Checks if a range is empty; if it contains no characters
|
216
|
+
# @return [Boolean]
|
217
|
+
def empty?: () -> untyped
|
218
|
+
|
219
|
+
#
|
220
|
+
# Compare ranges, first by begin_pos, then by end_pos.
|
221
|
+
#
|
222
|
+
def <=>: (untyped other) -> (nil | untyped)
|
223
|
+
|
224
|
+
alias eql? ==
|
225
|
+
|
226
|
+
#
|
227
|
+
# Support for Ranges be used in as Hash indices and in Sets.
|
228
|
+
#
|
229
|
+
def hash: () -> untyped
|
230
|
+
|
231
|
+
#
|
232
|
+
# @return [String] a human-readable representation of this range.
|
233
|
+
#
|
234
|
+
def inspect: () -> ::String
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Parser
|
2
|
+
module AST
|
3
|
+
class Node
|
4
|
+
attr_reader type: Symbol
|
5
|
+
|
6
|
+
attr_reader children: Array[untyped]
|
7
|
+
|
8
|
+
def initialize: (Symbol `type`, Array[untyped] children) -> void
|
9
|
+
|
10
|
+
def updated: (?Symbol?, ?Array[untyped]?) -> Node
|
11
|
+
|
12
|
+
attr_reader location: Source::Map
|
13
|
+
|
14
|
+
alias loc location
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Steep
|
2
|
+
module AST
|
3
|
+
module Annotation
|
4
|
+
class Collection
|
5
|
+
attr_reader annotations: untyped
|
6
|
+
|
7
|
+
attr_reader factory: Types::Factory
|
8
|
+
|
9
|
+
attr_reader context: RBS::Resolver::context
|
10
|
+
|
11
|
+
attr_reader var_type_annotations: Hash[Symbol, VarType]
|
12
|
+
|
13
|
+
attr_reader const_type_annotations: Hash[RBS::TypeName, ConstType]
|
14
|
+
|
15
|
+
attr_reader ivar_type_annotations: Hash[Symbol, IvarType]
|
16
|
+
|
17
|
+
attr_reader method_type_annotations: untyped
|
18
|
+
|
19
|
+
attr_reader block_type_annotation: untyped
|
20
|
+
|
21
|
+
attr_reader return_type_annotation: untyped
|
22
|
+
|
23
|
+
attr_reader self_type_annotation: untyped
|
24
|
+
|
25
|
+
attr_reader instance_type_annotation: untyped
|
26
|
+
|
27
|
+
attr_reader module_type_annotation: untyped
|
28
|
+
|
29
|
+
attr_reader implement_module_annotation: untyped
|
30
|
+
|
31
|
+
attr_reader dynamic_annotations: untyped
|
32
|
+
|
33
|
+
attr_reader break_type_annotation: untyped
|
34
|
+
|
35
|
+
def initialize: (annotations: untyped, factory: untyped, context: untyped) -> void
|
36
|
+
|
37
|
+
def absolute_type: (untyped `type`) -> (untyped | nil)
|
38
|
+
|
39
|
+
def var_type: (?lvar: untyped?, ?ivar: untyped?, ?const: untyped?) -> untyped
|
40
|
+
|
41
|
+
def method_type: (untyped name) -> (untyped | nil)
|
42
|
+
|
43
|
+
def block_type: () -> untyped
|
44
|
+
|
45
|
+
def return_type: () -> untyped
|
46
|
+
|
47
|
+
def self_type: () -> untyped
|
48
|
+
|
49
|
+
def instance_type: () -> untyped
|
50
|
+
|
51
|
+
def module_type: () -> untyped
|
52
|
+
|
53
|
+
def break_type: () -> untyped
|
54
|
+
|
55
|
+
def lvar_types: () -> untyped
|
56
|
+
|
57
|
+
def ivar_types: () -> untyped
|
58
|
+
|
59
|
+
def const_types: () -> untyped
|
60
|
+
|
61
|
+
def instance_dynamics: () -> untyped
|
62
|
+
|
63
|
+
def module_dynamics: () -> untyped
|
64
|
+
|
65
|
+
def merge_block_annotations: (untyped annotations) -> untyped
|
66
|
+
|
67
|
+
def any?: () { () -> untyped } -> untyped
|
68
|
+
|
69
|
+
def size: () -> untyped
|
70
|
+
|
71
|
+
def include?: (untyped obj) -> untyped
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
module Steep
|
2
|
+
module AST
|
3
|
+
module Annotation
|
4
|
+
type t = ReturnType | BlockType | SelfType | InstanceType | ModuleType | BreakType
|
5
|
+
| MethodType | VarType | ConstType | IvarType
|
6
|
+
| Implements | Dynamic
|
7
|
+
|
8
|
+
type loc = RBS::Location[untyped, untyped]
|
9
|
+
|
10
|
+
class Named
|
11
|
+
attr_reader name: Symbol
|
12
|
+
|
13
|
+
attr_reader type: Types::t
|
14
|
+
|
15
|
+
attr_reader location: loc?
|
16
|
+
|
17
|
+
def initialize: (name: Symbol, type: Types::t, ?location: loc?) -> void
|
18
|
+
|
19
|
+
def ==: (untyped other) -> bool
|
20
|
+
end
|
21
|
+
|
22
|
+
class Typed
|
23
|
+
attr_reader type: Types::t
|
24
|
+
|
25
|
+
attr_reader annotation: untyped
|
26
|
+
|
27
|
+
attr_reader location: loc?
|
28
|
+
|
29
|
+
def initialize: (type: Types::t, ?location: loc?) -> void
|
30
|
+
|
31
|
+
def ==: (untyped other) -> bool
|
32
|
+
end
|
33
|
+
|
34
|
+
class ReturnType < Typed
|
35
|
+
end
|
36
|
+
|
37
|
+
class BlockType < Typed
|
38
|
+
end
|
39
|
+
|
40
|
+
class SelfType < Typed
|
41
|
+
end
|
42
|
+
|
43
|
+
class InstanceType < Typed
|
44
|
+
end
|
45
|
+
|
46
|
+
class ModuleType < Typed
|
47
|
+
end
|
48
|
+
|
49
|
+
class BreakType < Typed
|
50
|
+
end
|
51
|
+
|
52
|
+
class MethodType < Named
|
53
|
+
end
|
54
|
+
|
55
|
+
class VarType < Named
|
56
|
+
end
|
57
|
+
|
58
|
+
class ConstType < Named
|
59
|
+
attr_reader name: RBS::TypeName
|
60
|
+
|
61
|
+
attr_reader type: Types::t
|
62
|
+
|
63
|
+
attr_reader location: loc?
|
64
|
+
|
65
|
+
def initialize: (name: RBS::TypeName, type: untyped, ?location: loc?) -> void
|
66
|
+
|
67
|
+
def ==: (untyped other) -> bool
|
68
|
+
end
|
69
|
+
|
70
|
+
class IvarType < Named
|
71
|
+
end
|
72
|
+
|
73
|
+
class Implements
|
74
|
+
class Module
|
75
|
+
attr_reader name: RBS::TypeName
|
76
|
+
|
77
|
+
attr_reader args: Array[Types::t]
|
78
|
+
|
79
|
+
def initialize: (name: RBS::TypeName, args: Array[Types::t]) -> void
|
80
|
+
|
81
|
+
def ==: (untyped other) -> bool
|
82
|
+
|
83
|
+
alias eql? ==
|
84
|
+
|
85
|
+
def hash: () -> Integer
|
86
|
+
end
|
87
|
+
|
88
|
+
attr_reader location: loc?
|
89
|
+
|
90
|
+
attr_reader name: Module
|
91
|
+
|
92
|
+
def initialize: (name: Module, ?location: loc?) -> void
|
93
|
+
|
94
|
+
def ==: (untyped other) -> bool
|
95
|
+
end
|
96
|
+
|
97
|
+
class Dynamic
|
98
|
+
class Name
|
99
|
+
type kind = :instance | :module_instance | :module
|
100
|
+
|
101
|
+
attr_reader kind: kind
|
102
|
+
|
103
|
+
attr_reader name: Symbol
|
104
|
+
|
105
|
+
attr_reader location: loc?
|
106
|
+
|
107
|
+
def initialize: (name: Symbol, kind: kind, ?location: loc?) -> void
|
108
|
+
|
109
|
+
def instance_method?: () -> bool
|
110
|
+
|
111
|
+
def module_method?: () -> bool
|
112
|
+
|
113
|
+
def ==: (untyped other) -> bool
|
114
|
+
end
|
115
|
+
|
116
|
+
attr_reader location: loc?
|
117
|
+
|
118
|
+
attr_reader names: Array[Name]
|
119
|
+
|
120
|
+
def initialize: (names: Array[Name], ?location: loc?) -> void
|
121
|
+
|
122
|
+
def ==: (untyped other) -> bool
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Steep
|
2
|
+
module AST
|
3
|
+
module Builtin
|
4
|
+
class Type
|
5
|
+
attr_reader module_name: RBS::TypeName
|
6
|
+
|
7
|
+
attr_reader arity: Integer
|
8
|
+
|
9
|
+
def initialize: (String module_name, ?arity: ::Integer) -> void
|
10
|
+
|
11
|
+
def instance_type: (*Types::t args, ?fill_untyped: bool) -> Types::Name::Instance
|
12
|
+
|
13
|
+
def module_type: () -> Types::Name::Singleton
|
14
|
+
|
15
|
+
def instance_type?: (Types::t `type`, ?args: Array[Types::t]?) -> bool
|
16
|
+
|
17
|
+
def module_type?: (Types::t `type`) -> bool
|
18
|
+
end
|
19
|
+
|
20
|
+
Object: Type
|
21
|
+
|
22
|
+
BasicObject: Type
|
23
|
+
|
24
|
+
Array: Type
|
25
|
+
|
26
|
+
Range: Type
|
27
|
+
|
28
|
+
Hash: Type
|
29
|
+
|
30
|
+
Module: Type
|
31
|
+
|
32
|
+
Class: Type
|
33
|
+
|
34
|
+
Integer: Type
|
35
|
+
|
36
|
+
Float: Type
|
37
|
+
|
38
|
+
String: Type
|
39
|
+
|
40
|
+
Symbol: Type
|
41
|
+
|
42
|
+
TrueClass: Type
|
43
|
+
|
44
|
+
FalseClass: Type
|
45
|
+
|
46
|
+
Regexp: Type
|
47
|
+
|
48
|
+
NilClass: Type
|
49
|
+
|
50
|
+
Proc: Type
|
51
|
+
|
52
|
+
def self.nil_type: () -> Types::Nil
|
53
|
+
|
54
|
+
def self.any_type: () -> Types::Any
|
55
|
+
|
56
|
+
def self.bool_type: () -> Types::Boolean
|
57
|
+
|
58
|
+
def self.bottom_type: () -> Types::Bot
|
59
|
+
|
60
|
+
def self.top_type: () -> Types::Top
|
61
|
+
|
62
|
+
def self.optional: (Types::t `type`) -> Types::Union
|
63
|
+
|
64
|
+
def self.true_type: () -> Types::Literal
|
65
|
+
|
66
|
+
def self.false_type: () -> Types::Literal
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Steep
|
2
|
+
module AST
|
3
|
+
module Types
|
4
|
+
class Any
|
5
|
+
attr_reader location: untyped
|
6
|
+
|
7
|
+
def initialize: (?location: untyped?) -> void
|
8
|
+
|
9
|
+
def ==: (untyped other) -> untyped
|
10
|
+
|
11
|
+
def hash: () -> untyped
|
12
|
+
|
13
|
+
alias eql? ==
|
14
|
+
|
15
|
+
def subst: (untyped s) -> self
|
16
|
+
|
17
|
+
def to_s: () -> "untyped"
|
18
|
+
|
19
|
+
include Helper::NoFreeVariables
|
20
|
+
|
21
|
+
include Helper::NoChild
|
22
|
+
|
23
|
+
def level: () -> ::Array[1]
|
24
|
+
|
25
|
+
def with_location: (untyped new_location) -> untyped
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Steep
|
2
|
+
module AST
|
3
|
+
module Types
|
4
|
+
class Boolean
|
5
|
+
attr_reader location: untyped
|
6
|
+
|
7
|
+
def initialize: (?location: untyped?) -> void
|
8
|
+
|
9
|
+
def ==: (untyped other) -> untyped
|
10
|
+
|
11
|
+
def hash: () -> untyped
|
12
|
+
|
13
|
+
alias eql? ==
|
14
|
+
|
15
|
+
def subst: (untyped s) -> self
|
16
|
+
|
17
|
+
def to_s: () -> "bool"
|
18
|
+
|
19
|
+
include Helper::NoFreeVariables
|
20
|
+
|
21
|
+
include Helper::NoChild
|
22
|
+
|
23
|
+
def level: () -> ::Array[0]
|
24
|
+
|
25
|
+
def with_location: (untyped new_location) -> untyped
|
26
|
+
|
27
|
+
def back_type: () -> untyped
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Steep
|
2
|
+
module AST
|
3
|
+
module Types
|
4
|
+
class Bot
|
5
|
+
attr_reader location: untyped
|
6
|
+
|
7
|
+
def initialize: (?location: untyped?) -> void
|
8
|
+
|
9
|
+
def ==: (untyped other) -> untyped
|
10
|
+
|
11
|
+
def hash: () -> untyped
|
12
|
+
|
13
|
+
alias eql? ==
|
14
|
+
|
15
|
+
def subst: (untyped s) -> self
|
16
|
+
|
17
|
+
def to_s: () -> "bot"
|
18
|
+
|
19
|
+
include Helper::NoFreeVariables
|
20
|
+
|
21
|
+
include Helper::NoChild
|
22
|
+
|
23
|
+
def level: () -> ::Array[2]
|
24
|
+
|
25
|
+
def with_location: (untyped new_location) -> untyped
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Steep
|
2
|
+
module AST
|
3
|
+
module Types
|
4
|
+
class Class
|
5
|
+
attr_reader location: untyped
|
6
|
+
|
7
|
+
def initialize: (?location: untyped?) -> void
|
8
|
+
|
9
|
+
def to_s: () -> "class"
|
10
|
+
|
11
|
+
def ==: (untyped other) -> untyped
|
12
|
+
|
13
|
+
def hash: () -> untyped
|
14
|
+
|
15
|
+
alias eql? ==
|
16
|
+
|
17
|
+
def subst: (untyped s) -> untyped
|
18
|
+
|
19
|
+
def free_variables: () -> untyped
|
20
|
+
|
21
|
+
include Helper::NoChild
|
22
|
+
|
23
|
+
def level: () -> ::Array[0]
|
24
|
+
|
25
|
+
def with_location: (untyped new_location) -> untyped
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|