steep 1.2.1 → 1.3.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/CHANGELOG.md +16 -0
- data/Gemfile.lock +4 -4
- data/Gemfile.steep +1 -1
- data/Gemfile.steep.lock +13 -3
- data/Steepfile +0 -1
- data/lib/steep/annotation_parser.rb +34 -28
- data/lib/steep/ast/annotation.rb +16 -5
- data/lib/steep/ast/node/type_application.rb +74 -0
- data/lib/steep/ast/node/type_assertion.rb +56 -0
- data/lib/steep/ast/types/factory.rb +5 -1
- data/lib/steep/diagnostic/helper.rb +2 -1
- data/lib/steep/diagnostic/lsp_formatter.rb +3 -1
- data/lib/steep/diagnostic/ruby.rb +70 -5
- data/lib/steep/diagnostic/signature.rb +21 -8
- data/lib/steep/drivers/check.rb +1 -1
- data/lib/steep/drivers/checkfile.rb +1 -1
- data/lib/steep/drivers/langserver.rb +2 -2
- data/lib/steep/drivers/stats.rb +1 -1
- data/lib/steep/drivers/watch.rb +1 -1
- data/lib/steep/drivers/worker.rb +0 -1
- data/lib/steep/server/lsp_formatter.rb +13 -3
- data/lib/steep/server/master.rb +4 -1
- data/lib/steep/server/worker_process.rb +86 -14
- data/lib/steep/services/hover_provider/rbs.rb +7 -7
- data/lib/steep/services/hover_provider/ruby.rb +19 -4
- data/lib/steep/services/signature_service.rb +7 -4
- data/lib/steep/signature/validator.rb +36 -13
- data/lib/steep/source.rb +189 -71
- data/lib/steep/type_construction.rb +232 -126
- data/lib/steep/type_inference/logic_type_interpreter.rb +3 -1
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +2 -0
- data/rbs_collection.steep.lock.yaml +27 -10
- data/rbs_collection.steep.yaml +0 -1
- data/sig/shims/exception.rbs +4 -0
- data/sig/shims/parser/comment.rbs +33 -0
- data/sig/shims/parser.rbs +30 -2
- data/sig/steep/annotation_parser.rbs +59 -0
- data/sig/steep/ast/annotation.rbs +21 -26
- data/sig/steep/ast/node/type_application.rbs +31 -0
- data/sig/steep/ast/node/type_assertion.rbs +26 -0
- data/sig/steep/ast/types/factory.rbs +0 -2
- data/sig/steep/diagnostic/helper.rbs +9 -3
- data/sig/steep/diagnostic/lsp_formatter.rbs +12 -8
- data/sig/steep/diagnostic/ruby.rbs +62 -8
- data/sig/steep/diagnostic/signature.rbs +118 -85
- data/sig/steep/drivers/worker.rbs +11 -13
- data/sig/steep/range_extension.rbs +7 -0
- data/sig/steep/server/lsp_formatter.rbs +14 -7
- data/sig/steep/server/worker_process.rbs +74 -12
- data/sig/steep/services/hover_provider/rbs.rbs +27 -7
- data/sig/steep/services/hover_provider/ruby.rbs +18 -4
- data/sig/steep/services/hover_provider/singleton_methods.rbs +1 -1
- data/sig/steep/signature/validator.rbs +76 -0
- data/sig/steep/source.rbs +54 -30
- data/sig/steep/type_construction.rbs +85 -27
- data/sig/steep/type_inference/method_call.rbs +1 -1
- data/smoke/diagnostics-rbs/inherit-module.rbs +2 -0
- data/smoke/diagnostics-rbs/test_expectations.yml +12 -0
- data/steep.gemspec +1 -1
- metadata +16 -6
@@ -1,215 +1,248 @@
|
|
1
1
|
module Steep
|
2
2
|
module Diagnostic
|
3
3
|
module Signature
|
4
|
+
type location = RBS::Location[untyped, untyped]
|
5
|
+
|
4
6
|
class Base
|
5
7
|
include Helper
|
6
8
|
|
7
|
-
attr_reader location:
|
9
|
+
attr_reader location: location?
|
8
10
|
|
9
|
-
def initialize: (location:
|
11
|
+
def initialize: (location: location?) -> void
|
10
12
|
|
11
|
-
def header_line: () ->
|
13
|
+
def header_line: () -> String
|
12
14
|
|
13
|
-
def detail_lines: () ->
|
15
|
+
def detail_lines: () -> String?
|
14
16
|
|
15
|
-
def diagnostic_code: () ->
|
17
|
+
def diagnostic_code: () -> String
|
16
18
|
|
17
|
-
def path: () ->
|
19
|
+
def path: () -> Pathname?
|
18
20
|
end
|
19
21
|
|
20
22
|
class SyntaxError < Base
|
21
|
-
attr_reader exception:
|
23
|
+
attr_reader exception: RBS::ParsingError
|
22
24
|
|
23
|
-
def initialize: (
|
25
|
+
def initialize: (RBS::ParsingError exception, location: location?) -> void
|
24
26
|
|
25
|
-
def self.parser_syntax_error_message: (
|
27
|
+
def self.parser_syntax_error_message: (RBS::ParsingError exception) -> String
|
26
28
|
|
27
|
-
def header_line: () ->
|
29
|
+
def header_line: () -> String
|
28
30
|
end
|
29
31
|
|
30
32
|
class DuplicatedDeclaration < Base
|
31
|
-
attr_reader type_name:
|
33
|
+
attr_reader type_name: RBS::TypeName | Symbol
|
32
34
|
|
33
|
-
def initialize: (type_name:
|
35
|
+
def initialize: (type_name: RBS::TypeName | Symbol, location: location?) -> void
|
34
36
|
|
35
|
-
def header_line: () ->
|
37
|
+
def header_line: () -> String
|
36
38
|
end
|
37
39
|
|
38
40
|
class UnknownTypeName < Base
|
39
|
-
attr_reader name:
|
41
|
+
attr_reader name: RBS::TypeName
|
40
42
|
|
41
|
-
def initialize: (name:
|
43
|
+
def initialize: (name: RBS::TypeName, location: location?) -> void
|
42
44
|
|
43
|
-
def header_line: () ->
|
45
|
+
def header_line: () -> String
|
44
46
|
end
|
45
47
|
|
46
48
|
class InvalidTypeApplication < Base
|
47
|
-
attr_reader name:
|
49
|
+
attr_reader name: RBS::TypeName
|
48
50
|
|
49
|
-
attr_reader args:
|
51
|
+
attr_reader args: Array[AST::Types::t]
|
50
52
|
|
51
|
-
attr_reader params:
|
53
|
+
attr_reader params: Array[Symbol]
|
52
54
|
|
53
|
-
def initialize: (name:
|
55
|
+
def initialize: (name: RBS::TypeName, args: Array[AST::Types::t], params: Array[Symbol], location: location?) -> void
|
54
56
|
|
55
|
-
def header_line: () ->
|
57
|
+
def header_line: () -> String
|
56
58
|
end
|
57
59
|
|
58
60
|
class UnsatisfiableTypeApplication < Base
|
59
|
-
attr_reader type_name:
|
61
|
+
attr_reader type_name: RBS::TypeName
|
60
62
|
|
61
|
-
attr_reader type_arg:
|
63
|
+
attr_reader type_arg: AST::Types::t
|
62
64
|
|
63
|
-
attr_reader type_param:
|
65
|
+
attr_reader type_param: Interface::TypeParam
|
64
66
|
|
65
|
-
def initialize: (type_name:
|
67
|
+
def initialize: (type_name: RBS::TypeName, type_arg: AST::Types::t, type_param: Interface::TypeParam, location: location?) -> void
|
66
68
|
|
67
|
-
def header_line: () ->
|
69
|
+
def header_line: () -> String
|
68
70
|
end
|
69
71
|
|
70
72
|
class InvalidMethodOverload < Base
|
71
|
-
attr_reader class_name:
|
73
|
+
attr_reader class_name: RBS::TypeName
|
72
74
|
|
73
|
-
attr_reader method_name:
|
75
|
+
attr_reader method_name: Symbol
|
74
76
|
|
75
|
-
def initialize: (class_name:
|
77
|
+
def initialize: (class_name: RBS::TypeName, method_name: Symbol, location: location?) -> void
|
76
78
|
|
77
|
-
def header_line: () ->
|
79
|
+
def header_line: () -> String
|
78
80
|
end
|
79
81
|
|
80
82
|
class UnknownMethodAlias < Base
|
81
|
-
attr_reader class_name:
|
83
|
+
attr_reader class_name: RBS::TypeName
|
82
84
|
|
83
|
-
attr_reader method_name:
|
85
|
+
attr_reader method_name: Symbol
|
84
86
|
|
85
|
-
def initialize: (class_name:
|
87
|
+
def initialize: (class_name: RBS::TypeName, method_name: Symbol, location: location?) -> void
|
86
88
|
|
87
|
-
def header_line: () ->
|
89
|
+
def header_line: () -> String
|
88
90
|
end
|
89
91
|
|
90
92
|
class DuplicatedMethodDefinition < Base
|
91
|
-
attr_reader class_name:
|
93
|
+
attr_reader class_name: RBS::TypeName
|
92
94
|
|
93
|
-
attr_reader method_name:
|
95
|
+
attr_reader method_name: Symbol
|
94
96
|
|
95
|
-
def initialize: (class_name:
|
97
|
+
def initialize: (class_name: RBS::TypeName, method_name: Symbol, location: location?) -> void
|
96
98
|
|
97
|
-
def header_line: () ->
|
99
|
+
def header_line: () -> String
|
98
100
|
end
|
99
101
|
|
100
102
|
class RecursiveAlias < Base
|
101
|
-
attr_reader class_name:
|
102
|
-
|
103
|
-
attr_reader names: untyped
|
103
|
+
attr_reader class_name: RBS::TypeName
|
104
104
|
|
105
|
-
attr_reader
|
105
|
+
attr_reader names: Array[Symbol]
|
106
106
|
|
107
|
-
def initialize: (class_name:
|
107
|
+
def initialize: (class_name: RBS::TypeName, names: Array[Symbol], location: location?) -> void
|
108
108
|
|
109
|
-
def header_line: () ->
|
109
|
+
def header_line: () -> String
|
110
110
|
end
|
111
111
|
|
112
112
|
class RecursiveAncestor < Base
|
113
|
-
attr_reader ancestors:
|
113
|
+
attr_reader ancestors: Array[RBS::Definition::Ancestor::t]
|
114
114
|
|
115
|
-
def initialize: (ancestors:
|
115
|
+
def initialize: (ancestors: Array[RBS::Definition::Ancestor::t], location: location?) -> void
|
116
116
|
|
117
|
-
def header_line: () ->
|
117
|
+
def header_line: () -> String
|
118
118
|
end
|
119
119
|
|
120
120
|
class SuperclassMismatch < Base
|
121
|
-
attr_reader name:
|
121
|
+
attr_reader name: RBS::TypeName
|
122
122
|
|
123
|
-
def initialize: (name:
|
123
|
+
def initialize: (name: RBS::TypeName, location: location?) -> void
|
124
124
|
|
125
|
-
def header_line: () ->
|
125
|
+
def header_line: () -> String
|
126
126
|
end
|
127
127
|
|
128
128
|
class GenericParameterMismatch < Base
|
129
|
-
attr_reader name:
|
129
|
+
attr_reader name: RBS::TypeName
|
130
130
|
|
131
|
-
def initialize: (name:
|
131
|
+
def initialize: (name: RBS::TypeName, location: location?) -> void
|
132
132
|
|
133
|
-
def header_line: () ->
|
133
|
+
def header_line: () -> String
|
134
134
|
end
|
135
135
|
|
136
136
|
class InvalidVarianceAnnotation < Base
|
137
|
-
attr_reader name:
|
137
|
+
attr_reader name: RBS::TypeName
|
138
138
|
|
139
|
-
attr_reader param:
|
139
|
+
attr_reader param: RBS::AST::TypeParam
|
140
140
|
|
141
|
-
def initialize: (name:
|
141
|
+
def initialize: (name: RBS::TypeName, param: RBS::AST::TypeParam, location: location?) -> void
|
142
142
|
|
143
|
-
def header_line: () ->
|
143
|
+
def header_line: () -> String
|
144
144
|
end
|
145
145
|
|
146
146
|
class ModuleSelfTypeError < Base
|
147
|
-
attr_reader name:
|
147
|
+
attr_reader name: RBS::TypeName
|
148
148
|
|
149
|
-
attr_reader ancestor:
|
149
|
+
attr_reader ancestor: RBS::DefinitionBuilder::AncestorBuilder::OneAncestors
|
150
150
|
|
151
|
-
attr_reader relation:
|
151
|
+
attr_reader relation: Subtyping::Relation[AST::Types::t]
|
152
152
|
|
153
|
-
def initialize: (name:
|
153
|
+
def initialize: (name: RBS::TypeName, ancestor: RBS::DefinitionBuilder::AncestorBuilder::OneAncestors, relation: Subtyping::Relation[AST::Types::t], location: location?) -> void
|
154
154
|
|
155
|
-
def header_line: () ->
|
155
|
+
def header_line: () -> String
|
156
156
|
end
|
157
157
|
|
158
|
-
class
|
159
|
-
attr_reader
|
158
|
+
class ClassVariableDuplicationError < Base
|
159
|
+
attr_reader class_name: RBS::TypeName
|
160
|
+
|
161
|
+
attr_reader other_class_name: RBS::TypeName
|
162
|
+
|
163
|
+
attr_reader variable_name: Symbol
|
164
|
+
|
165
|
+
def initialize: (class_name: RBS::TypeName, other_class_name: RBS::TypeName, variable_name: Symbol, location: RBS::Location[untyped, untyped]) -> void
|
166
|
+
|
167
|
+
def header_line: () -> String
|
168
|
+
end
|
169
|
+
|
170
|
+
# The error is raised when a class variable is defined in both `class_name` and `other_class_name`
|
171
|
+
#
|
172
|
+
class ClassVariableDuplicationError < Base
|
173
|
+
attr_reader class_name: RBS::TypeName
|
174
|
+
attr_reader other_class_name: RBS::TypeName
|
175
|
+
attr_reader variable_name: Symbol
|
160
176
|
|
161
|
-
|
177
|
+
def initialize: (class_name: RBS::TypeName, other_class_name: RBS::TypeName, variable_name: Symbol, location: RBS::Location[untyped, untyped]) -> void
|
162
178
|
|
163
|
-
|
179
|
+
def header_line: () -> String
|
180
|
+
end
|
181
|
+
|
182
|
+
|
183
|
+
class InstanceVariableTypeError < Base
|
184
|
+
attr_reader name: Symbol
|
185
|
+
|
186
|
+
attr_reader var_type: AST::Types::t
|
164
187
|
|
165
|
-
attr_reader parent_type:
|
188
|
+
attr_reader parent_type: AST::Types::t
|
166
189
|
|
167
|
-
def initialize: (name:
|
190
|
+
def initialize: (name: Symbol, location: location?, var_type: AST::Types::t, parent_type: AST::Types::t) -> void
|
168
191
|
|
169
|
-
def header_line: () ->
|
192
|
+
def header_line: () -> String
|
170
193
|
end
|
171
194
|
|
172
195
|
class MixinClassError < Base
|
173
|
-
attr_reader member:
|
196
|
+
attr_reader member: RBS::AST::Members::Include | RBS::AST::Members::Extend | RBS::AST::Members::Prepend
|
174
197
|
|
175
|
-
attr_reader type_name:
|
198
|
+
attr_reader type_name: RBS::TypeName
|
176
199
|
|
177
|
-
def initialize: (location:
|
200
|
+
def initialize: (location: location?, member: RBS::AST::Members::Include | RBS::AST::Members::Extend | RBS::AST::Members::Prepend, type_name: RBS::TypeName) -> void
|
178
201
|
|
179
|
-
def header_line: () ->
|
202
|
+
def header_line: () -> String
|
180
203
|
|
181
204
|
private
|
182
205
|
|
183
|
-
def mixin_name: () ->
|
206
|
+
def mixin_name: () -> String
|
207
|
+
end
|
208
|
+
|
209
|
+
# A class definition has a module as its super class
|
210
|
+
#
|
211
|
+
class InheritModuleError < Base
|
212
|
+
attr_reader super_class: RBS::AST::Declarations::Class::Super
|
213
|
+
|
214
|
+
def initialize: (RBS::AST::Declarations::Class::Super) -> void
|
215
|
+
|
216
|
+
def header_line: () -> String
|
184
217
|
end
|
185
218
|
|
186
219
|
class UnexpectedError < Base
|
187
|
-
attr_reader message:
|
220
|
+
attr_reader message: String
|
188
221
|
|
189
|
-
def initialize: (message:
|
222
|
+
def initialize: (message: String, location: location?) -> void
|
190
223
|
|
191
|
-
def header_line: () ->
|
224
|
+
def header_line: () -> String
|
192
225
|
end
|
193
226
|
|
194
227
|
class RecursiveTypeAlias < Base
|
195
|
-
attr_reader alias_names:
|
228
|
+
attr_reader alias_names: Array[RBS::TypeName]
|
196
229
|
|
197
|
-
def initialize: (alias_names:
|
230
|
+
def initialize: (alias_names: Array[RBS::TypeName], location: location?) -> void
|
198
231
|
|
199
|
-
def header_line: () ->
|
232
|
+
def header_line: () -> String
|
200
233
|
end
|
201
234
|
|
202
235
|
class NonregularTypeAlias < Base
|
203
|
-
attr_reader type_name:
|
236
|
+
attr_reader type_name: RBS::TypeName
|
204
237
|
|
205
|
-
attr_reader nonregular_type:
|
238
|
+
attr_reader nonregular_type: AST::Types::t
|
206
239
|
|
207
|
-
def initialize: (type_name:
|
240
|
+
def initialize: (type_name: RBS::TypeName, nonregular_type: AST::Types::t, location: location?) -> void
|
208
241
|
|
209
|
-
def header_line: () ->
|
242
|
+
def header_line: () -> String
|
210
243
|
end
|
211
244
|
|
212
|
-
def self.from_rbs_error: (
|
245
|
+
def self.from_rbs_error: (RBS::BaseError error, factory: AST::Types::Factory) -> Base
|
213
246
|
end
|
214
247
|
end
|
215
248
|
end
|
@@ -1,31 +1,29 @@
|
|
1
1
|
module Steep
|
2
2
|
module Drivers
|
3
3
|
class Worker
|
4
|
-
attr_reader stdout:
|
4
|
+
attr_reader stdout: IO
|
5
5
|
|
6
|
-
attr_reader stderr:
|
6
|
+
attr_reader stderr: IO
|
7
7
|
|
8
|
-
attr_reader stdin:
|
8
|
+
attr_reader stdin: IO
|
9
9
|
|
10
|
-
attr_accessor
|
10
|
+
attr_accessor worker_type: Symbol
|
11
11
|
|
12
|
-
attr_accessor
|
12
|
+
attr_accessor worker_name: String
|
13
13
|
|
14
|
-
attr_accessor
|
14
|
+
attr_accessor delay_shutdown: bool
|
15
15
|
|
16
|
-
attr_accessor
|
16
|
+
attr_accessor max_index: Integer
|
17
17
|
|
18
|
-
attr_accessor
|
18
|
+
attr_accessor index: Integer
|
19
19
|
|
20
|
-
attr_accessor
|
21
|
-
|
22
|
-
attr_accessor commandline_args: untyped
|
20
|
+
attr_accessor commandline_args: Array[String]
|
23
21
|
|
24
22
|
include Utils::DriverHelper
|
25
23
|
|
26
|
-
def initialize: (stdout:
|
24
|
+
def initialize: (stdout: IO, stderr: IO, stdin: IO) -> void
|
27
25
|
|
28
|
-
def run: () ->
|
26
|
+
def run: () -> Integer
|
29
27
|
end
|
30
28
|
end
|
31
29
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class RBS::Location[in RK, in OK]
|
2
|
+
def as_lsp_range: () -> { start: { line: Integer, character: Integer }, end: { line: Integer, character: Integer } }
|
3
|
+
end
|
4
|
+
|
5
|
+
class Parser::Source::Range
|
6
|
+
def as_lsp_range: () -> { start: { line: Integer, character: Integer }, end: { line: Integer, character: Integer } }
|
7
|
+
end
|
@@ -4,26 +4,33 @@ module Steep
|
|
4
4
|
include Services
|
5
5
|
|
6
6
|
class CommentBuilder
|
7
|
+
@array: Array[String]
|
8
|
+
|
7
9
|
def initialize: () -> void
|
8
10
|
|
9
|
-
def self.build: () { (
|
11
|
+
def self.build: () { (CommentBuilder) -> void } -> String
|
10
12
|
|
11
|
-
def to_s: () ->
|
13
|
+
def to_s: () -> String
|
12
14
|
|
13
|
-
def <<: (
|
15
|
+
def <<: (String? string) -> void
|
14
16
|
|
15
|
-
def push: () { (
|
17
|
+
def push: () { (String) -> void } -> void
|
16
18
|
end
|
17
19
|
|
18
|
-
def self?.format_hover_content: (
|
20
|
+
def self?.format_hover_content: (Services::HoverProvider::Ruby::content | Services::HoverProvider::RBS::content) -> untyped
|
19
21
|
|
20
|
-
def self?.to_list: (
|
22
|
+
def self?.to_list: [A < Object] (Enumerable[A] collection) ?{ (A) -> String } -> String
|
21
23
|
|
22
24
|
def self?.name_and_args: (untyped name, untyped args) -> ::String
|
23
25
|
|
24
26
|
def self?.name_and_params: (untyped name, untyped params) -> ::String
|
25
27
|
|
26
|
-
|
28
|
+
type summarizable_decl = ::RBS::AST::Declarations::Class
|
29
|
+
| ::RBS::AST::Declarations::Module
|
30
|
+
| ::RBS::AST::Declarations::Interface
|
31
|
+
| ::RBS::AST::Declarations::Alias
|
32
|
+
|
33
|
+
def self?.declaration_summary: (summarizable_decl) -> String
|
27
34
|
end
|
28
35
|
end
|
29
36
|
end
|
@@ -1,29 +1,91 @@
|
|
1
1
|
module Steep
|
2
2
|
module Server
|
3
|
+
# WorkerProcess class represents a worker process
|
4
|
+
#
|
5
|
+
# Available operations are:
|
6
|
+
#
|
7
|
+
# 1. Sending a LSP message to the process
|
8
|
+
# 2. Receiving a LSP message from the process
|
9
|
+
# 3. Killing the process
|
10
|
+
#
|
11
|
+
# The process may be invoked by
|
12
|
+
#
|
13
|
+
# 1. `#fork` if available, or
|
14
|
+
# 2. `#spawn` otherwise
|
15
|
+
#
|
16
|
+
# `#fork` version is faster because it skips loading libraries.
|
17
|
+
#
|
18
|
+
#
|
3
19
|
class WorkerProcess
|
4
|
-
|
20
|
+
interface _ProcessWaitThread
|
21
|
+
def pid: () -> Integer
|
22
|
+
end
|
5
23
|
|
6
|
-
attr_reader
|
24
|
+
attr_reader reader: LanguageServer::Protocol::Transport::Io::Reader
|
7
25
|
|
8
|
-
attr_reader
|
26
|
+
attr_reader writer: LanguageServer::Protocol::Transport::Io::Writer
|
9
27
|
|
10
|
-
attr_reader
|
28
|
+
attr_reader stderr: IO?
|
11
29
|
|
12
|
-
attr_reader
|
30
|
+
attr_reader name: String
|
13
31
|
|
14
|
-
attr_reader
|
32
|
+
attr_reader wait_thread: Thread & _ProcessWaitThread
|
15
33
|
|
16
|
-
|
34
|
+
attr_reader index: Integer?
|
17
35
|
|
18
|
-
def
|
36
|
+
def initialize: (
|
37
|
+
reader: LanguageServer::Protocol::Transport::Io::Reader,
|
38
|
+
writer: LanguageServer::Protocol::Transport::Io::Writer,
|
39
|
+
stderr: IO?,
|
40
|
+
wait_thread: Thread & _ProcessWaitThread,
|
41
|
+
name: String,
|
42
|
+
?index: Integer?
|
43
|
+
) -> void
|
19
44
|
|
20
|
-
|
45
|
+
type worker_type = :interaction | :typecheck
|
21
46
|
|
22
|
-
def
|
47
|
+
def self.start_worker: (
|
48
|
+
worker_type `type`,
|
49
|
+
name: String,
|
50
|
+
steepfile: Pathname,
|
51
|
+
?steep_command: ::String,
|
52
|
+
?patterns: Array[String],
|
53
|
+
?delay_shutdown: bool,
|
54
|
+
?index: [Integer, Integer]?
|
55
|
+
) -> WorkerProcess
|
23
56
|
|
24
|
-
def
|
57
|
+
def self.fork_worker: (
|
58
|
+
worker_type `type`,
|
59
|
+
name: String,
|
60
|
+
steepfile: Pathname,
|
61
|
+
patterns: Array[String],
|
62
|
+
delay_shutdown: bool,
|
63
|
+
index: [Integer, Integer]?
|
64
|
+
) -> WorkerProcess
|
25
65
|
|
26
|
-
def
|
66
|
+
def self.spawn_worker: (
|
67
|
+
worker_type `type`,
|
68
|
+
name: String,
|
69
|
+
steepfile: Pathname,
|
70
|
+
steep_command: ::String,
|
71
|
+
patterns: Array[String],
|
72
|
+
delay_shutdown: bool,
|
73
|
+
index: [Integer, Integer]?
|
74
|
+
) -> WorkerProcess
|
75
|
+
|
76
|
+
def self.start_typecheck_workers: (
|
77
|
+
steepfile: Pathname,
|
78
|
+
args: Array[String],
|
79
|
+
?steep_command: ::String,
|
80
|
+
?count: Integer,
|
81
|
+
?delay_shutdown: bool
|
82
|
+
) -> Array[WorkerProcess]
|
83
|
+
|
84
|
+
def <<: (untyped message) -> void
|
85
|
+
|
86
|
+
def read: () { (untyped) -> void } -> void
|
87
|
+
|
88
|
+
def kill: () -> void
|
27
89
|
end
|
28
90
|
end
|
29
91
|
end
|
@@ -2,19 +2,39 @@ module Steep
|
|
2
2
|
module Services
|
3
3
|
module HoverProvider
|
4
4
|
class RBS
|
5
|
-
TypeAliasContent
|
5
|
+
class TypeAliasContent
|
6
|
+
attr_reader location: ::RBS::Location[untyped, untyped]
|
6
7
|
|
7
|
-
|
8
|
+
attr_reader decl: ::RBS::AST::Declarations::Alias
|
8
9
|
|
9
|
-
|
10
|
+
def initialize: (location: ::RBS::Location[untyped, untyped], decl: ::RBS::AST::Declarations::Alias) -> void
|
11
|
+
end
|
10
12
|
|
11
|
-
|
13
|
+
class ClassContent
|
14
|
+
attr_reader location: ::RBS::Location[untyped, untyped]
|
12
15
|
|
13
|
-
|
16
|
+
attr_reader decl: ::RBS::AST::Declarations::Class | ::RBS::AST::Declarations::Module
|
14
17
|
|
15
|
-
|
18
|
+
def initialize: (location: ::RBS::Location[untyped, untyped], decl: ::RBS::AST::Declarations::Class | ::RBS::AST::Declarations::Module) -> void
|
19
|
+
end
|
16
20
|
|
17
|
-
|
21
|
+
class InterfaceContent
|
22
|
+
attr_reader location: ::RBS::Location[untyped, untyped]
|
23
|
+
|
24
|
+
attr_reader decl: ::RBS::AST::Declarations::Interface
|
25
|
+
|
26
|
+
def initialize: (location: ::RBS::Location[untyped, untyped], decl: ::RBS::AST::Declarations::Interface) -> void
|
27
|
+
end
|
28
|
+
|
29
|
+
type content = TypeAliasContent | ClassContent | InterfaceContent
|
30
|
+
|
31
|
+
attr_reader service: TypeCheckService
|
32
|
+
|
33
|
+
def initialize: (service: TypeCheckService) -> void
|
34
|
+
|
35
|
+
def project: () -> Project
|
36
|
+
|
37
|
+
def content_for: (target: Project::Target, path: Pathname, line: Integer, column: Integer) -> content?
|
18
38
|
end
|
19
39
|
end
|
20
40
|
end
|
@@ -35,10 +35,24 @@ module Steep
|
|
35
35
|
def initialize: (node: Parser::AST::Node, name: Symbol, type: AST::Types::t, location: Parser::Source::Range) -> void
|
36
36
|
end
|
37
37
|
|
38
|
+
class TypeAssertionContent
|
39
|
+
attr_reader node: Parser::AST::Node
|
40
|
+
|
41
|
+
attr_reader original_type: AST::Types::t
|
42
|
+
|
43
|
+
attr_reader asserted_type: AST::Types::t
|
44
|
+
|
45
|
+
attr_reader location: Parser::Source::Range
|
46
|
+
|
47
|
+
def initialize: (node: Parser::AST::Node, original_type: AST::Types::t, asserted_type: AST::Types::t, location: Parser::Source::Range) -> void
|
48
|
+
end
|
49
|
+
|
38
50
|
class MethodCallContent
|
39
51
|
attr_reader node: Parser::AST::Node
|
40
52
|
|
41
|
-
|
53
|
+
type call = TypeInference::MethodCall::Typed | TypeInference::MethodCall::Special | TypeInference::MethodCall::Error
|
54
|
+
|
55
|
+
attr_reader method_call: call
|
42
56
|
|
43
57
|
attr_reader location: Parser::Source::Range
|
44
58
|
|
@@ -81,13 +95,13 @@ module Steep
|
|
81
95
|
def comments: () -> Array[::RBS::AST::Comment]
|
82
96
|
|
83
97
|
# Returns true if `decl` is a class/module definition
|
84
|
-
def class_or_module?: () ->
|
98
|
+
def class_or_module?: () -> (::RBS::Environment::ClassEntry | ::RBS::Environment::ModuleEntry | nil)
|
85
99
|
|
86
100
|
# Returns true if `decl` is a constant definition
|
87
|
-
def constant?: () ->
|
101
|
+
def constant?: () -> ::RBS::Environment::SingleEntry[::RBS::TypeName, ::RBS::AST::Declarations::Constant]?
|
88
102
|
end
|
89
103
|
|
90
|
-
type content = TypeContent | VariableContent | MethodCallContent | DefinitionContent | ConstantContent
|
104
|
+
type content = TypeContent | VariableContent | MethodCallContent | DefinitionContent | ConstantContent | TypeAssertionContent
|
91
105
|
|
92
106
|
attr_reader service: TypeCheckService
|
93
107
|
|
@@ -2,7 +2,7 @@ module Steep
|
|
2
2
|
module Services
|
3
3
|
module HoverProvider
|
4
4
|
module SingletonMethods
|
5
|
-
def content_for: (service: TypeCheckService, path: Pathname, line: Integer, column: Integer) -> (Ruby | RBS | nil)
|
5
|
+
def content_for: (service: TypeCheckService, path: Pathname, line: Integer, column: Integer) -> (Ruby::content | RBS::content | nil)
|
6
6
|
end
|
7
7
|
|
8
8
|
extend SingletonMethods
|