steep 1.4.0.dev.2 → 1.4.0.dev.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -2
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +9 -11
  5. data/Gemfile.steep +1 -2
  6. data/Gemfile.steep.lock +11 -14
  7. data/README.md +7 -1
  8. data/Steepfile +0 -3
  9. data/bin/rbs +0 -1
  10. data/guides/README.md +5 -0
  11. data/guides/src/gem-rbs-collection/gem-rbs-collection.md +143 -0
  12. data/guides/src/getting-started/getting-started.md +164 -0
  13. data/guides/src/nil-optional/nil-optional.md +195 -0
  14. data/lib/steep/diagnostic/ruby.rb +80 -6
  15. data/lib/steep/drivers/check.rb +4 -4
  16. data/lib/steep/interface/block.rb +10 -0
  17. data/lib/steep/interface/builder.rb +3 -3
  18. data/lib/steep/method_name.rb +8 -0
  19. data/lib/steep/module_helper.rb +13 -11
  20. data/lib/steep/path_helper.rb +4 -0
  21. data/lib/steep/server/interaction_worker.rb +197 -230
  22. data/lib/steep/server/lsp_formatter.rb +308 -154
  23. data/lib/steep/server/master.rb +4 -1
  24. data/lib/steep/services/completion_provider.rb +140 -103
  25. data/lib/steep/services/hover_provider/rbs.rb +37 -32
  26. data/lib/steep/services/signature_help_provider.rb +108 -0
  27. data/lib/steep/services/type_name_completion.rb +165 -0
  28. data/lib/steep/source.rb +1 -0
  29. data/lib/steep/type_construction.rb +460 -266
  30. data/lib/steep/type_inference/block_params.rb +13 -0
  31. data/lib/steep/type_inference/context.rb +3 -3
  32. data/lib/steep/type_inference/method_call.rb +1 -1
  33. data/lib/steep/type_inference/method_params.rb +42 -16
  34. data/lib/steep/type_inference/send_args.rb +80 -51
  35. data/lib/steep/type_inference/type_env.rb +12 -4
  36. data/lib/steep/version.rb +1 -1
  37. data/lib/steep.rb +2 -0
  38. data/rbs_collection.steep.lock.yaml +0 -28
  39. data/rbs_collection.steep.yaml +10 -9
  40. data/sample/Steepfile +2 -0
  41. data/sample/lib/conference.rb +12 -0
  42. data/sample/sig/conference.rbs +5 -0
  43. data/sig/shims/language-server_protocol.rbs +277 -0
  44. data/sig/shims/parser/nodes.rbs +37 -0
  45. data/sig/shims/parser.rbs +4 -0
  46. data/sig/shims/string.rbs +4 -0
  47. data/sig/steep/ast/types/factory.rbs +10 -8
  48. data/sig/steep/diagnostic/lsp_formatter.rbs +1 -1
  49. data/sig/steep/diagnostic/ruby.rbs +38 -2
  50. data/sig/steep/drivers/check.rbs +1 -1
  51. data/sig/steep/drivers/checkfile.rbs +1 -1
  52. data/sig/steep/drivers/diagnostic_printer.rbs +1 -1
  53. data/sig/steep/drivers/watch.rbs +1 -1
  54. data/sig/steep/index/signature_symbol_provider.rbs +1 -1
  55. data/sig/steep/interface/block.rbs +2 -0
  56. data/sig/steep/interface/builder.rbs +5 -3
  57. data/sig/steep/interface/method_type.rbs +5 -3
  58. data/sig/steep/method_name.rbs +5 -1
  59. data/sig/steep/module_helper.rbs +9 -0
  60. data/sig/steep/path_helper.rbs +3 -1
  61. data/sig/steep/server/base_worker.rbs +1 -1
  62. data/sig/steep/server/interaction_worker.rbs +52 -17
  63. data/sig/steep/server/lsp_formatter.rbs +43 -18
  64. data/sig/steep/server/master.rbs +1 -1
  65. data/sig/steep/server/type_check_worker.rbs +7 -5
  66. data/sig/steep/server/worker_process.rbs +6 -4
  67. data/sig/steep/services/completion_provider.rbs +106 -28
  68. data/sig/steep/services/hover_provider/rbs.rbs +13 -9
  69. data/sig/steep/services/signature_help_provider.rbs +39 -0
  70. data/sig/steep/services/type_name_completion.rbs +122 -0
  71. data/sig/steep/type_construction.rbs +99 -30
  72. data/sig/steep/type_inference/block_params.rbs +4 -0
  73. data/sig/steep/type_inference/context.rbs +70 -22
  74. data/sig/steep/type_inference/method_call.rbs +1 -1
  75. data/sig/steep/type_inference/method_params.rbs +43 -24
  76. data/sig/steep/type_inference/multiple_assignment.rbs +1 -1
  77. data/sig/steep/type_inference/send_args.rbs +19 -5
  78. data/sig/steep/typing.rbs +8 -3
  79. data/smoke/diagnostics/test_expectations.yml +1 -0
  80. data/steep.gemspec +0 -1
  81. metadata +12 -16
@@ -16,5 +16,282 @@ module LanguageServer
16
16
  end
17
17
  end
18
18
  end
19
+
20
+ module Constant
21
+ module DiagnosticSeverity
22
+ ERROR: String
23
+
24
+ WARNING: String
25
+
26
+ INFORMATION: String
27
+
28
+ HINT: String
29
+ end
30
+
31
+ module CompletionItemKind
32
+ type t = Integer
33
+
34
+ TEXT: Integer
35
+ METHOD: Integer
36
+ FUNCTION: Integer
37
+ CONSTRUCTOR: Integer
38
+ FIELD: Integer
39
+ VARIABLE: Integer
40
+ CLASS: Integer
41
+ INTERFACE: Integer
42
+ MODULE: Integer
43
+ PROPERTY: Integer
44
+ UNIT: Integer
45
+ VALUE: Integer
46
+ ENUM: Integer
47
+ KEYWORD: Integer
48
+ SNIPPET: Integer
49
+ COLOR: Integer
50
+ FILE: Integer
51
+ REFERENCE: Integer
52
+ FOLDER: Integer
53
+ ENUMMEMBER: Integer
54
+ CONSTANT: Integer
55
+ STRUCT: Integer
56
+ EVENT: Integer
57
+ OPERATOR: Integer
58
+ TYPEPARAMETER: Integer
59
+ end
60
+
61
+ module CompletionItemTag
62
+ type t = Integer
63
+
64
+ Deprecated: Integer
65
+ end
66
+
67
+ module InsertTextFormat
68
+ type t = Integer
69
+
70
+ PLAIN_TEXT: Integer
71
+
72
+ SNIPPET: Integer
73
+ end
74
+
75
+ module InsertTextMode
76
+ type t = Integer
77
+
78
+ AS_IS: Integer
79
+
80
+ ADJUST_INDENTATION: Integer
81
+ end
82
+
83
+ module MarkupKind
84
+ type t = "plaintext" | "markdown"
85
+
86
+ PLAINTEXT: "plaintext"
87
+
88
+ MARKDOWN: "markdown"
89
+ end
90
+ end
91
+
92
+ module Interface
93
+ interface _Base
94
+ def attributes: () -> Hash[Symbol, untyped]
95
+
96
+ alias to_hash attributes
97
+
98
+ def to_json: () -> String
99
+ end
100
+
101
+ class Position
102
+ include _Base
103
+
104
+ # 0-origin line number
105
+ attr_reader line: Integer
106
+
107
+ # 0-origin character position (== cursor position)
108
+ attr_reader character: Integer
109
+
110
+ def initialize: (line: Integer, character: Integer) -> void
111
+ | (Hash[Symbol, untyped]) -> void
112
+ end
113
+
114
+ class Range
115
+ include _Base
116
+
117
+ attr_reader start: Position
118
+
119
+ attr_reader end: Position
120
+
121
+ def initialize: (start: Position, end: Position) -> void
122
+ | (Hash[Symbol, untyped]) -> void
123
+ end
124
+
125
+ class MarkupContent
126
+ include _Base
127
+
128
+ attr_reader kind: Constant::MarkupKind::t
129
+
130
+ attr_reader value: String
131
+
132
+ def initialize: (kind: Constant::MarkupKind::t, value: String) -> void
133
+ end
134
+
135
+ class TextEdit
136
+ include _Base
137
+
138
+ attr_reader range: Range
139
+
140
+ attr_reader new_text: String
141
+
142
+ def initialize: (range: Range, new_text: String) -> void
143
+ end
144
+
145
+ class InsertReplaceEdit
146
+ include _Base
147
+
148
+ attr_reader new_text: String
149
+
150
+ attr_reader insert: Range
151
+
152
+ attr_reader replace: Range
153
+
154
+ def initialize: (new_text: String, insert: Range, replace: Range) -> void
155
+ end
156
+
157
+ class Command
158
+ include _Base
159
+
160
+ attr_reader title: String
161
+
162
+ attr_reader command: String
163
+
164
+ attr_reader arguments: Array[untyped]?
165
+
166
+ def initialize: (title: String, command: String, ?arguments: Array[untyped]?) -> void
167
+ end
168
+
169
+ class Hover
170
+ include _Base
171
+
172
+ attr_reader contents: MarkupContent
173
+
174
+ attr_reader range: Range
175
+
176
+ def initialize: (contents: MarkupContent, range: Range) -> void
177
+ end
178
+
179
+ class CompletionList
180
+ include _Base
181
+
182
+ attr_reader is_incomplete: bool
183
+
184
+ attr_reader items: Array[CompletionItem]
185
+
186
+ def initialize: (items: Array[CompletionItem], is_incomplete: bool) -> void
187
+ end
188
+
189
+ class CompletionItem
190
+ include _Base
191
+
192
+ attr_reader label: String
193
+
194
+ attr_reader label_details: CompletionItemLabelDetails?
195
+
196
+ attr_reader kind: Constant::CompletionItemKind::t?
197
+
198
+ attr_reader tags: Array[Constant::CompletionItemTag::t]?
199
+
200
+ attr_reader detail: String?
201
+
202
+ attr_reader documentation: MarkupContent?
203
+
204
+ attr_reader preselect: bool?
205
+
206
+ attr_reader sort_text: String?
207
+
208
+ attr_reader filter_text: String?
209
+
210
+ attr_reader insert_text: String?
211
+
212
+ attr_reader insert_text_format: Constant::InsertTextFormat::t?
213
+
214
+ attr_reader insert_text_mode: Constant::InsertTextMode::t?
215
+
216
+ attr_reader text_edit: TextEdit | InsertReplaceEdit | nil
217
+
218
+ attr_reader text_edit_text: String?
219
+
220
+ attr_reader additional_text_edits: Array[TextEdit]?
221
+
222
+ attr_reader commit_characters: Array[String]?
223
+
224
+ attr_reader command: Command?
225
+
226
+ attr_reader data: untyped?
227
+
228
+ def initialize:(
229
+ label: String,
230
+ ?label_details: CompletionItemLabelDetails?,
231
+ ?kind: Constant::CompletionItemKind::t?,
232
+ ?tags: Array[Constant::CompletionItemTag::t]?,
233
+ ?detail: String?,
234
+ ?documentation: MarkupContent?,
235
+ ?preselect: bool?,
236
+ ?sort_text: String?,
237
+ ?filter_text: String?,
238
+ ?insert_text: String?,
239
+ ?insert_text_format: Constant::InsertTextFormat::t?,
240
+ ?insert_text_mode: Constant::InsertTextMode::t?,
241
+ ?text_edit: TextEdit | InsertReplaceEdit | nil,
242
+ ?text_edit_text: String?,
243
+ ?additional_text_edits: Array[TextEdit]?,
244
+ ?commit_characters: Array[String]?,
245
+ ?command: Command?,
246
+ ?data: untyped?
247
+ ) -> void
248
+ end
249
+
250
+ class CompletionItemLabelDetails
251
+ include _Base
252
+
253
+ attr_reader detail: String?
254
+
255
+ attr_reader description: String?
256
+
257
+ def initialize: (?detail: String?, ?description: String?) -> void
258
+ end
259
+
260
+ class SignatureInformation
261
+ include _Base
262
+
263
+ attr_reader label: String
264
+
265
+ attr_reader documentation: MarkupContent?
266
+
267
+ attr_reader parameters: Array[ParameterInformation]?
268
+
269
+ attr_reader active_parameter: Integer?
270
+
271
+ def initialize: (label: String, ?documentation: MarkupContent?, ?parameters: Array[ParameterInformation]?, ?active_parameter: Integer?) -> void
272
+ end
273
+
274
+ class ParameterInformation
275
+ include _Base
276
+
277
+ attr_reader label: String | [Integer, Integer]
278
+
279
+ attr_reader documentation: MarkupContent?
280
+
281
+ def initialize: (label: String | [Integer, Integer], ?documentation: MarkupContent) -> void
282
+ end
283
+
284
+ class SignatureHelp
285
+ include _Base
286
+
287
+ attr_reader signatures: Array[SignatureInformation]
288
+
289
+ attr_reader active_signature: Integer?
290
+
291
+ attr_reader active_parameter: Integer?
292
+
293
+ def initialize: (signatures: Array[SignatureInformation], ?active_signature: Integer?, ?active_parameter: Integer?) -> void
294
+ end
295
+ end
19
296
  end
20
297
  end
@@ -0,0 +1,37 @@
1
+ module Parser
2
+ module AST
3
+ interface _BlockNode
4
+ def type: () -> :block
5
+
6
+ %a{pure} def loc: () -> (Source::Map & _BlockLocation)
7
+ end
8
+
9
+ interface _BlockLocation
10
+ %a{pure} def end: () -> Source::Range
11
+ end
12
+
13
+ interface _DefNode
14
+ def type: () -> :def
15
+
16
+ def children: () -> [Symbol, Node, Node?]
17
+
18
+ %a{pure} def loc: () -> (Source::Map & _DefLocation)
19
+ end
20
+
21
+ interface _DefLocation
22
+ %a{pure} def end: () -> Source::Range?
23
+ end
24
+
25
+ interface _CaseNode
26
+ def type: () -> :case
27
+
28
+ %a{pure} def loc: () -> (Source::Map & _CaseLocation)
29
+ end
30
+
31
+ interface _CaseLocation
32
+ %a{pure} def else: () -> Source::Range?
33
+
34
+ %a{pure} def end: () -> Source::Range
35
+ end
36
+ end
37
+ end
data/sig/shims/parser.rbs CHANGED
@@ -36,10 +36,14 @@ module Parser
36
36
  attr_accessor self.emit_lambda: bool
37
37
  attr_accessor self.emit_procarg0: bool
38
38
  attr_accessor self.emit_kwargs: bool
39
+ attr_accessor self.emit_forward_arg: bool
39
40
 
40
41
  def string_value: (untyped) -> untyped
41
42
 
42
43
  def value: (untyped) -> untyped
43
44
  end
44
45
  end
46
+
47
+ class SyntaxError < StandardError
48
+ end
45
49
  end
@@ -0,0 +1,4 @@
1
+ class String
2
+ def start_with?: (Regexp) -> bool
3
+ | ...
4
+ end
@@ -1,3 +1,5 @@
1
+ use RBS::TypeName, RBS::Resolver::TypeNameResolver
2
+
1
3
  module Steep
2
4
  module AST
3
5
  module Types
@@ -10,13 +12,13 @@ module Steep
10
12
 
11
13
  attr_reader type_interface_cache: untyped
12
14
 
13
- @type_name_resolver: RBS::Resolver::TypeNameResolver?
15
+ @type_name_resolver: TypeNameResolver?
14
16
 
15
17
  def inspect: () -> String
16
18
 
17
19
  def initialize: (builder: RBS::DefinitionBuilder) -> void
18
20
 
19
- def type_name_resolver: () -> RBS::Resolver::TypeNameResolver
21
+ def type_name_resolver: () -> TypeNameResolver
20
22
 
21
23
  def type: (RBS::Types::t `type`) -> t
22
24
 
@@ -40,7 +42,7 @@ module Steep
40
42
 
41
43
  def method_type_1: (Interface::MethodType method_type) -> RBS::MethodType
42
44
 
43
- def unfold: (RBS::TypeName type_name, Array[t] args) -> t
45
+ def unfold: (TypeName type_name, Array[t] args) -> t
44
46
 
45
47
  # Unfold type alias one step, or returns itself
46
48
  #
@@ -51,7 +53,7 @@ module Steep
51
53
  # * Unions and intersections are expanded
52
54
  # * Returns `nil` if it is recursive
53
55
  #
54
- def deep_expand_alias: (t `type`, ?recursive: Set[RBS::TypeName]) -> t?
56
+ def deep_expand_alias: (t `type`, ?recursive: Set[TypeName]) -> t?
55
57
 
56
58
  # Convert union types to array of types
57
59
  #
@@ -59,17 +61,17 @@ module Steep
59
61
 
60
62
  def unwrap_optional: (Types::t `type`) -> [Types::t, Types::t]
61
63
 
62
- def module_name?: (RBS::TypeName type_name) -> bool
64
+ def module_name?: (TypeName type_name) -> bool
63
65
 
64
- def class_name?: (RBS::TypeName type_name) -> bool
66
+ def class_name?: (TypeName type_name) -> bool
65
67
 
66
68
  def env: () -> RBS::Environment
67
69
 
68
70
  def absolute_type: (t `type`, context: RBS::Resolver::context) -> t
69
71
 
70
- def absolute_type_name: (RBS::TypeName type_name, context: RBS::Resolver::context) -> RBS::TypeName?
72
+ def absolute_type_name: (TypeName type_name, context: RBS::Resolver::context) -> TypeName?
71
73
 
72
- def instance_type: (RBS::TypeName type_name, ?args: Array[t]?, ?location: untyped?) -> t
74
+ def instance_type: (TypeName type_name, ?args: Array[t]?, ?location: untyped?) -> t
73
75
 
74
76
  def try_singleton_type: (t) -> t?
75
77
 
@@ -1,7 +1,7 @@
1
1
  module Steep
2
2
  module Diagnostic
3
3
  class LSPFormatter
4
- LSP: singleton(LanguageServer::Protocol)
4
+ module LSP = LanguageServer::Protocol
5
5
 
6
6
  type config = Hash[singleton(Diagnostic::Ruby::Base) | singleton(Diagnostic::Signature::Base), severity?]
7
7
 
@@ -24,9 +24,15 @@ module Steep
24
24
  end
25
25
 
26
26
  module ResultPrinter : _DiagnosticWithResult
27
- def relation_message: (untyped relation) -> untyped
27
+ def relation_message: (Subtyping::Relation[untyped] relation) -> String?
28
28
 
29
- def detail_lines: () -> untyped
29
+ def detail_lines: () -> String?
30
+ end
31
+
32
+ module ResultPrinter2 : _DiagnosticWithResult
33
+ def result_line: (Subtyping::Result::t result) -> String?
34
+
35
+ def detail_lines: () -> String?
30
36
  end
31
37
 
32
38
  class IncompatibleAssignment < Base
@@ -524,6 +530,36 @@ module Steep
524
530
  def header_line: () -> String
525
531
  end
526
532
 
533
+ # Argument forwarding `...` cannot be done safely, because of
534
+ #
535
+ # 1. The arguments are incompatible, or
536
+ # 2. The blocks are incompatible
537
+ #
538
+ class IncompatibleArgumentForwarding < Base
539
+ attr_reader method_name: Symbol
540
+
541
+ attr_reader params_pair: [Interface::Function::Params, Interface::Function::Params]?
542
+
543
+ attr_reader block_pair: [Interface::Block?, Interface::Block?]?
544
+
545
+ attr_reader result: Subtyping::Result::Base
546
+
547
+ include ResultPrinter2
548
+
549
+ # One of `params_pair:` or `block_pair:` is specified where the first object is of the source method (`#foo`) and the second value is of the target method (`#bar`)
550
+ #
551
+ # ```ruby
552
+ # def foo(...)
553
+ # bar(...)
554
+ # end
555
+ # ```
556
+ #
557
+ def initialize: (node: Parser::AST::Node, method_name: Symbol, params_pair: [Interface::Function::Params, Interface::Function::Params], result: Subtyping::Result::Base) -> void
558
+ | (node: Parser::AST::Node, method_name: Symbol, block_pair: [Interface::Block?, Interface::Block?], result: Subtyping::Result::Base) -> void
559
+
560
+ def header_line: () -> String
561
+ end
562
+
527
563
  ALL: Array[singleton(Base)]
528
564
 
529
565
  type template = Hash[singleton(Base), LSPFormatter::severity]
@@ -1,7 +1,7 @@
1
1
  module Steep
2
2
  module Drivers
3
3
  class Check
4
- LSP: untyped
4
+ module LSP = LanguageServer::Protocol
5
5
 
6
6
  attr_reader stdout: untyped
7
7
 
@@ -1,7 +1,7 @@
1
1
  module Steep
2
2
  module Drivers
3
3
  class Checkfile
4
- LSP: singleton(LanguageServer::Protocol)
4
+ module LSP = LanguageServer::Protocol
5
5
 
6
6
  attr_reader stdout: IO
7
7
 
@@ -1,7 +1,7 @@
1
1
  module Steep
2
2
  module Drivers
3
3
  class DiagnosticPrinter
4
- LSP: untyped
4
+ module LSP = LanguageServer::Protocol
5
5
 
6
6
  attr_reader stdout: untyped
7
7
 
@@ -15,7 +15,7 @@ module Steep
15
15
 
16
16
  include Utils::DriverHelper
17
17
 
18
- LSP: singleton(LanguageServer::Protocol)
18
+ module LSP = LanguageServer::Protocol
19
19
 
20
20
  def initialize: (stdout: IO, stderr: IO) -> void
21
21
 
@@ -1,7 +1,7 @@
1
1
  module Steep
2
2
  module Index
3
3
  class SignatureSymbolProvider
4
- LSP: untyped
4
+ module LSP = LanguageServer::Protocol
5
5
 
6
6
  SymbolInformation: untyped
7
7
 
@@ -32,6 +32,8 @@ module Steep
32
32
  def map_type: () { (AST::Types::t) -> AST::Types::t } -> Block
33
33
 
34
34
  def +: (Block other) -> Block
35
+
36
+ def to_proc_type: () -> AST::Types::t
35
37
  end
36
38
  end
37
39
  end
@@ -1,3 +1,5 @@
1
+ use RBS::TypeName
2
+
1
3
  module Steep
2
4
  module Interface
3
5
  class Builder
@@ -85,11 +87,11 @@ module Steep
85
87
  attr_reader cache: Hash[cache_key, Shape?]
86
88
 
87
89
  # No type application (if generic), no self-instance-module resolution
88
- attr_reader raw_instance_object_shape_cache: Hash[[RBS::TypeName, bool], Shape]
90
+ attr_reader raw_instance_object_shape_cache: Hash[[TypeName, bool], Shape]
89
91
 
90
- attr_reader raw_singleton_object_shape_cache: Hash[[RBS::TypeName, bool], Shape]
92
+ attr_reader raw_singleton_object_shape_cache: Hash[[TypeName, bool], Shape]
91
93
 
92
- attr_reader raw_interface_object_shape_cache: Hash[[RBS::TypeName, bool], Shape]
94
+ attr_reader raw_interface_object_shape_cache: Hash[[TypeName, bool], Shape]
93
95
 
94
96
  def initialize: (AST::Types::Factory) -> void
95
97
 
@@ -1,3 +1,5 @@
1
+ use Steep::TypeInference::MethodCall::MethodDecl
2
+
1
3
  module Steep
2
4
  module Interface
3
5
  class MethodType
@@ -7,11 +9,11 @@ module Steep
7
9
 
8
10
  attr_reader block: Block?
9
11
 
10
- attr_reader method_decls: Set[TypeInference::MethodCall::MethodDecl]
12
+ attr_reader method_decls: Set[MethodDecl]
11
13
 
12
14
  @fvs: Set[Symbol]
13
15
 
14
- def initialize: (type_params: Array[TypeParam], type: Function, block: Block?, method_decls: Set[TypeInference::MethodCall::MethodDecl]) -> void
16
+ def initialize: (type_params: Array[TypeParam], type: Function, block: Block?, method_decls: Set[MethodDecl]) -> void
15
17
 
16
18
  def ==: (untyped other) -> bool
17
19
 
@@ -28,7 +30,7 @@ module Steep
28
30
 
29
31
  def instantiate: (Substitution s) -> MethodType
30
32
 
31
- def with: (?type_params: Array[TypeParam], ?type: Function, ?block: Block?, ?method_decls: Set[TypeInference::MethodCall::MethodDecl]) -> MethodType
33
+ def with: (?type_params: Array[TypeParam], ?type: Function, ?block: Block?, ?method_decls: Set[MethodDecl]) -> MethodType
32
34
 
33
35
  def to_s: () -> ::String
34
36
 
@@ -6,6 +6,8 @@ module Steep
6
6
  attr_reader method_name: Symbol
7
7
 
8
8
  def initialize: (type_name: RBS::TypeName, method_name: Symbol) -> void
9
+
10
+ def relative: () -> InstanceMethodName
9
11
  end
10
12
 
11
13
  class SingletonMethodName
@@ -13,6 +15,8 @@ module Steep
13
15
  attr_reader method_name: Symbol
14
16
 
15
17
  def initialize: (type_name: RBS::TypeName, method_name: Symbol) -> void
18
+
19
+ def relative: () -> SingletonMethodName
16
20
  end
17
21
 
18
22
  class ::Object
@@ -20,7 +24,7 @@ module Steep
20
24
  #
21
25
  # * `ClassName#method_name` syntax returns an `InstanceMethodName` object
22
26
  # * `ClassName.method_name` syntax returns a `SingletonMethodName` object
23
- #
27
+ #
24
28
  def MethodName: (String string) -> (InstanceMethodName | SingletonMethodName)
25
29
  end
26
30
  end
@@ -1,7 +1,16 @@
1
1
  module Steep
2
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
+ #
3
10
  def module_name_from_node: (Parser::AST::Node? parent_node, Symbol constant_name) -> RBS::TypeName?
4
11
 
12
+ # Translate a *const* node to a namespace if possible
13
+ #
5
14
  def namespace_from_node: (Parser::AST::Node? node) -> RBS::Namespace?
6
15
  end
7
16
  end
@@ -6,8 +6,10 @@ module Steep
6
6
  #
7
7
  def self?.to_pathname: (String uri, ?dosish: bool) -> Pathname?
8
8
 
9
+ def self?.to_pathname!: (String uri, ?dosish: bool) -> Pathname
10
+
9
11
  # Receives a Pathname and returns a *file* URI
10
- #
12
+ #
11
13
  def self?.to_uri: (Pathname path, ?dosish: bool) -> URI::File
12
14
  end
13
15
  end
@@ -9,7 +9,7 @@ module Steep
9
9
  def close: () -> void
10
10
  end
11
11
 
12
- LSP: untyped
12
+ module LSP = LanguageServer::Protocol
13
13
 
14
14
  @skip_jobs_after_shutdown: bool
15
15