steep 1.2.1 → 1.3.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/Gemfile.lock +4 -4
  4. data/Gemfile.steep +1 -1
  5. data/Gemfile.steep.lock +13 -3
  6. data/Steepfile +0 -1
  7. data/bin/steep-prof +1 -1
  8. data/lib/steep/annotation_parser.rb +34 -28
  9. data/lib/steep/ast/annotation.rb +16 -5
  10. data/lib/steep/ast/node/type_application.rb +74 -0
  11. data/lib/steep/ast/node/type_assertion.rb +56 -0
  12. data/lib/steep/ast/types/factory.rb +5 -1
  13. data/lib/steep/ast/types/helper.rb +4 -3
  14. data/lib/steep/ast/types/logic.rb +4 -0
  15. data/lib/steep/diagnostic/helper.rb +2 -1
  16. data/lib/steep/diagnostic/lsp_formatter.rb +3 -1
  17. data/lib/steep/diagnostic/ruby.rb +70 -5
  18. data/lib/steep/diagnostic/signature.rb +21 -8
  19. data/lib/steep/drivers/check.rb +2 -2
  20. data/lib/steep/drivers/checkfile.rb +2 -2
  21. data/lib/steep/drivers/langserver.rb +2 -2
  22. data/lib/steep/drivers/stats.rb +2 -2
  23. data/lib/steep/drivers/utils/jobs_option.rb +0 -4
  24. data/lib/steep/drivers/watch.rb +1 -1
  25. data/lib/steep/drivers/worker.rb +0 -1
  26. data/lib/steep/server/lsp_formatter.rb +13 -3
  27. data/lib/steep/server/master.rb +4 -1
  28. data/lib/steep/server/worker_process.rb +91 -14
  29. data/lib/steep/services/completion_provider.rb +2 -1
  30. data/lib/steep/services/goto_service.rb +2 -1
  31. data/lib/steep/services/hover_provider/rbs.rb +7 -7
  32. data/lib/steep/services/hover_provider/ruby.rb +21 -5
  33. data/lib/steep/services/signature_service.rb +23 -4
  34. data/lib/steep/services/type_check_service.rb +4 -4
  35. data/lib/steep/signature/validator.rb +36 -13
  36. data/lib/steep/source.rb +189 -71
  37. data/lib/steep/type_construction.rb +246 -135
  38. data/lib/steep/type_inference/logic_type_interpreter.rb +3 -1
  39. data/lib/steep/version.rb +1 -1
  40. data/lib/steep.rb +2 -0
  41. data/rbs_collection.steep.lock.yaml +27 -10
  42. data/rbs_collection.steep.yaml +0 -1
  43. data/sig/shims/exception.rbs +4 -0
  44. data/sig/shims/parser/comment.rbs +33 -0
  45. data/sig/shims/parser.rbs +30 -2
  46. data/sig/steep/annotation_parser.rbs +59 -0
  47. data/sig/steep/ast/annotation.rbs +21 -26
  48. data/sig/steep/ast/node/type_application.rbs +31 -0
  49. data/sig/steep/ast/node/type_assertion.rbs +26 -0
  50. data/sig/steep/ast/types/any.rbs +1 -1
  51. data/sig/steep/ast/types/boolean.rbs +1 -1
  52. data/sig/steep/ast/types/bot.rbs +1 -1
  53. data/sig/steep/ast/types/class.rbs +1 -1
  54. data/sig/steep/ast/types/factory.rbs +0 -2
  55. data/sig/steep/ast/types/helper.rbs +6 -3
  56. data/sig/steep/ast/types/instance.rbs +1 -1
  57. data/sig/steep/ast/types/intersection.rbs +1 -1
  58. data/sig/steep/ast/types/logic.rbs +2 -0
  59. data/sig/steep/ast/types/name.rbs +2 -2
  60. data/sig/steep/ast/types/nil.rbs +1 -1
  61. data/sig/steep/ast/types/record.rbs +1 -1
  62. data/sig/steep/ast/types/self.rbs +1 -1
  63. data/sig/steep/ast/types/top.rbs +2 -2
  64. data/sig/steep/ast/types/tuple.rbs +1 -1
  65. data/sig/steep/ast/types/union.rbs +1 -1
  66. data/sig/steep/ast/types/var.rbs +2 -2
  67. data/sig/steep/ast/types/void.rbs +1 -1
  68. data/sig/steep/diagnostic/helper.rbs +9 -3
  69. data/sig/steep/diagnostic/lsp_formatter.rbs +12 -8
  70. data/sig/steep/diagnostic/ruby.rbs +62 -8
  71. data/sig/steep/diagnostic/signature.rbs +118 -85
  72. data/sig/steep/drivers/utils/jobs_option.rbs +0 -2
  73. data/sig/steep/drivers/worker.rbs +11 -13
  74. data/sig/steep/range_extension.rbs +7 -0
  75. data/sig/steep/server/lsp_formatter.rbs +14 -7
  76. data/sig/steep/server/worker_process.rbs +74 -12
  77. data/sig/steep/services/hover_provider/rbs.rbs +27 -7
  78. data/sig/steep/services/hover_provider/ruby.rbs +18 -4
  79. data/sig/steep/services/hover_provider/singleton_methods.rbs +1 -1
  80. data/sig/steep/services/signature_service.rbs +14 -0
  81. data/sig/steep/services/type_check_service.rbs +2 -2
  82. data/sig/steep/signature/validator.rbs +76 -0
  83. data/sig/steep/source.rbs +54 -30
  84. data/sig/steep/type_construction.rbs +85 -27
  85. data/sig/steep/type_inference/method_call.rbs +1 -1
  86. data/sig/steep.rbs +2 -0
  87. data/smoke/diagnostics-rbs/inherit-module.rbs +2 -0
  88. data/smoke/diagnostics-rbs/test_expectations.yml +12 -0
  89. data/steep.gemspec +1 -1
  90. metadata +16 -6
@@ -16,9 +16,13 @@ module Steep
16
16
 
17
17
  @rbs_index: Index::RBSIndex?
18
18
 
19
+ @constant_resolver: RBS::Resolver::ConstantResolver?
20
+
19
21
  def initialize: (files: Hash[Pathname, FileStatus], changed_paths: Set[Pathname], diagnostics: Array[Diagnostic::Signature::Base], last_builder: RBS::DefinitionBuilder) -> void
20
22
 
21
23
  def rbs_index: () -> Index::RBSIndex
24
+
25
+ def constant_resolver: () -> RBS::Resolver::ConstantResolver
22
26
  end
23
27
 
24
28
  class AncestorErrorStatus
@@ -32,9 +36,13 @@ module Steep
32
36
 
33
37
  @rbs_index: Index::RBSIndex?
34
38
 
39
+ @constant_resolver: RBS::Resolver::ConstantResolver?
40
+
35
41
  def initialize: (files: Hash[Pathname, FileStatus], changed_paths: Set[Pathname], diagnostics: Array[Diagnostic::Signature::Base], last_builder: RBS::DefinitionBuilder) -> void
36
42
 
37
43
  def rbs_index: () -> Index::RBSIndex
44
+
45
+ def constant_resolver: () -> RBS::Resolver::ConstantResolver
38
46
  end
39
47
 
40
48
  class LoadedStatus
@@ -46,11 +54,15 @@ module Steep
46
54
 
47
55
  @subtyping: Subtyping::Check?
48
56
 
57
+ @constant_resolver: RBS::Resolver::ConstantResolver?
58
+
49
59
  def initialize: (files: Hash[Pathname, FileStatus], builder: RBS::DefinitionBuilder) -> void
50
60
 
51
61
  def subtyping: () -> Subtyping::Check
52
62
 
53
63
  def rbs_index: () -> Index::RBSIndex
64
+
65
+ def constant_resolver: () -> RBS::Resolver::ConstantResolver
54
66
  end
55
67
 
56
68
  class FileStatus
@@ -88,6 +100,8 @@ module Steep
88
100
 
89
101
  def latest_rbs_index: () -> Index::RBSIndex
90
102
 
103
+ def latest_constant_resolver: () -> RBS::Resolver::ConstantResolver
104
+
91
105
  def current_subtyping: () -> Subtyping::Check?
92
106
 
93
107
  def apply_changes: (Hash[Pathname, FileStatus] files, Server::ChangeBuffer::changes changes) -> Hash[Pathname, FileStatus]
@@ -91,9 +91,9 @@ module Steep
91
91
 
92
92
  def update_sources: (changes: Server::ChangeBuffer::changes, requests: Hash[Project::Target, TargetRequest]) -> void
93
93
 
94
- def type_check_file: (target: Project::Target, subtyping: Subtyping::Check, path: Pathname, text: String) -> SourceFile
94
+ def type_check_file: (target: Project::Target, subtyping: Subtyping::Check, path: Pathname, text: String) { () -> RBS::Resolver::ConstantResolver } -> SourceFile
95
95
 
96
- def self.type_check: (source: Source, subtyping: Subtyping::Check) -> Typing
96
+ def self.type_check: (source: Source, subtyping: Subtyping::Check, constant_resolver: RBS::Resolver::ConstantResolver) -> Typing
97
97
 
98
98
  def source_file?: (Pathname path) -> Project::Target?
99
99
 
@@ -0,0 +1,76 @@
1
+ module Steep
2
+ module Signature
3
+ class Validator
4
+ Location: singleton(RBS::Location)
5
+
6
+ Declarations: singleton(RBS::AST::Declarations)
7
+
8
+ attr_reader checker: Subtyping::Check
9
+
10
+ @errors: Array[Diagnostic::Signature::Base]
11
+
12
+ @type_name_resolver: RBS::TypeNameResolver?
13
+
14
+ @validator: RBS::Validator?
15
+
16
+ def initialize: (checker: Subtyping::Check) -> void
17
+
18
+ def has_error?: () -> bool
19
+
20
+ def no_error?: () -> bool
21
+
22
+ def each_error: () { (Diagnostic::Signature::Base) -> void } -> void
23
+ | () -> Enumerator[Diagnostic::Signature::Base, void]
24
+
25
+ def env: () -> RBS::Environment
26
+
27
+ def builder: () -> RBS::DefinitionBuilder
28
+
29
+ def type_name_resolver: () -> RBS::TypeNameResolver
30
+
31
+ def validator: () -> RBS::Validator
32
+
33
+ def factory: () -> AST::Types::Factory
34
+
35
+ def validate: () -> void
36
+
37
+ def validate_type_application_constraints: (RBS::TypeName type_name, Array[RBS::AST::TypeParam] type_params, Array[RBS::Types::t] type_args, location: RBS::Location[untyped, untyped]?) -> void
38
+
39
+ def validate_type_application: (RBS::Types::t) -> void
40
+
41
+ def validate_type: (RBS::Types::t `type`) -> untyped
42
+
43
+ def ancestor_to_type: (RBS::Definition::Ancestor::t ancestor) -> (AST::Types::Name::Interface | AST::Types::Name::Instance)
44
+
45
+ def mixin_constraints: (RBS::Definition definition, Array[RBS::Definition::Ancestor::Instance] mixin_ancestors, immediate_self_types: Array[RBS::Definition::Ancestor::t]?) -> Array[[Subtyping::Relation[AST::Types::t], RBS::Definition::Ancestor::Instance]]
46
+
47
+ def each_method_type: (RBS::Definition) { (RBS::MethodType) -> void } -> void
48
+
49
+ def each_variable_type: (RBS::Definition) { (RBS::Types::t) -> void } -> void
50
+
51
+ def validate_definition_type: (RBS::Definition) -> void
52
+
53
+ def validate_one_class: (RBS::TypeName) -> void
54
+
55
+ def validate_ancestor_application: (RBS::TypeName, RBS::Definition::Ancestor::Instance ancestor) -> void
56
+
57
+ def validate_one_interface: (RBS::TypeName) -> void
58
+
59
+ def validate_decl: () -> void
60
+
61
+ def validate_const: () -> void
62
+
63
+ def validate_one_constant: (RBS::TypeName name, RBS::Environment::SingleEntry[RBS::TypeName, RBS::AST::Declarations::Constant] entry) -> void
64
+
65
+ def validate_global: () -> void
66
+
67
+ def validate_one_global: (Symbol name, RBS::Environment::SingleEntry[Symbol, RBS::AST::Declarations::Global]) -> void
68
+
69
+ def validate_one_alias: (RBS::TypeName name, ?RBS::Environment::SingleEntry[RBS::TypeName, RBS::AST::Declarations::Alias] entry) -> void
70
+
71
+ def validate_alias: () -> void
72
+
73
+ def rescue_validation_errors: (?RBS::TypeName? type_name) { () -> void } -> void
74
+ end
75
+ end
76
+ end
data/sig/steep/source.rbs CHANGED
@@ -1,55 +1,79 @@
1
1
  module Steep
2
2
  class Source
3
- class LocatedAnnotation
4
- attr_reader line: untyped
3
+ extend NodeHelper
5
4
 
6
- attr_reader annotation: untyped
5
+ attr_reader path: Pathname
7
6
 
8
- attr_reader source: untyped
7
+ attr_reader node: Parser::AST::Node?
9
8
 
10
- def initialize: (line: untyped, source: untyped, annotation: untyped) -> void
9
+ attr_reader mapping: Hash[Parser::AST::Node, Array[AST::Annotation::t]]
11
10
 
12
- def ==: (untyped other) -> untyped
13
- end
14
-
15
- attr_reader path: untyped
16
-
17
- attr_reader node: untyped
18
-
19
- attr_reader mapping: untyped
20
-
21
- def initialize: (path: untyped, node: untyped, mapping: untyped) -> void
11
+ def initialize: (path: Pathname, node: Parser::AST::Node?, mapping: Hash[Parser::AST::Node, Array[AST::Annotation::t]]) -> void
22
12
 
23
- class Builder
13
+ class Builder < ::Parser::Builders::Default
24
14
  def string_value: (untyped token) -> untyped
25
15
  end
26
16
 
27
- def self.new_parser: () -> untyped
17
+ def self.new_parser: () -> Parser::Ruby31
28
18
 
29
- def self.parse: (untyped source_code, path: untyped, factory: untyped) -> untyped
19
+ def self.parse: (String source_code, path: Pathname, factory: AST::Types::Factory) -> Source
30
20
 
31
- def self.construct_mapping: (node: untyped, annotations: untyped, mapping: untyped, ?line_range: untyped?) -> untyped
21
+ def self.construct_mapping: (
22
+ node: Parser::AST::Node,
23
+ annotations: Array[AST::Annotation::t],
24
+ mapping: Hash[Parser::AST::Node, Array[AST::Annotation::t]],
25
+ ?line_range: Range[Integer]?
26
+ ) -> void
32
27
 
33
- def self.each_child_node: (untyped node) { (untyped) -> untyped } -> untyped
34
-
35
- def self.map_child_nodes: (untyped node) { (untyped) -> untyped } -> untyped
28
+ def self.map_child_node: (Parser::AST::Node node, ?Symbol? type, ?skip: Set[Parser::AST::Node]?) { (Parser::AST::Node) -> Parser::AST::Node } -> Parser::AST::Node
36
29
 
37
30
  def annotations: (block: Parser::AST::Node, factory: AST::Types::Factory, context: RBS::Resolver::context) -> AST::Annotation::Collection
38
31
 
39
- def each_annotation: () { (untyped, untyped) -> untyped } -> untyped
32
+ def each_annotation: () { ([Parser::AST::Node, Array[AST::Annotation::t]]) -> void } -> void
33
+ | () -> Enumerator[[Parser::AST::Node, Array[AST::Annotation::t]], void]
34
+
35
+ # Yields all heredoc node and its parents under `node` (or `self.node`)
36
+ #
37
+ # Yields arrays, inner node first, outer node last -- `[heredoc_node, *outer_node, node]`.
38
+ #
39
+ def each_heredoc_node: (?Parser::AST::Node? node, ?Array[Parser::AST::Node] parents) { (Array[Parser::AST::Node]) -> void } -> void
40
+ | (?Parser::AST::Node? node, ?Array[Parser::AST::Node] parents) -> Enumerator[Array[Parser::AST::Node], void]
41
+
42
+ # Returns array of nodes that is located inside heredoc
43
+ #
44
+ # ```ruby
45
+ # content = <<TEXT
46
+ # #{this or this}
47
+ # TEXT
48
+ # ```
49
+ #
50
+ # Returns arrays, inner node first, outer node last -- `[*nodes, heredoc_node]`.
51
+ #
52
+ def find_heredoc_nodes: (Integer line, Integer column, Integer position) -> Array[Parser::AST::Node]?
53
+
54
+ # Returns a node and it's outer nodes
55
+ #
56
+ def find_nodes_loc: (Parser::AST::Node node, Integer position, Array[Parser::AST::Node] parents) -> Array[Parser::AST::Node]?
57
+
58
+ # Returns a node and it's outer nodes
59
+ def find_nodes: (line: Integer, column: Integer) -> ::Array[Parser::AST::Node]?
60
+
61
+ def self.delete_defs: (Parser::AST::Node node, Set[Parser::AST::Node] allow_list) -> Parser::AST::Node
40
62
 
41
- def each_heredoc_node: (?untyped node, ?untyped parents) { (untyped) -> untyped } -> untyped
63
+ def without_unrelated_defs: (line: Integer, column: Integer) -> Source
42
64
 
43
- def find_heredoc_nodes: (untyped line, untyped column, untyped position) -> (untyped | nil)
65
+ type type_comment = AST::Node::TypeAssertion | AST::Node::TypeApplication
44
66
 
45
- def find_nodes_loc: (untyped node, untyped position, untyped parents) -> untyped
67
+ def self.insert_type_node: (Parser::AST::Node node, Hash[Integer, type_comment]) -> Parser::AST::Node
46
68
 
47
- def find_nodes: (line: Integer, column: Integer) -> ::Array[Parser::AST::Node]?
69
+ def self.adjust_location: (Parser::AST::Node) -> Parser::AST::Node
48
70
 
49
- def self.delete_defs: (untyped node, untyped allow_list) -> untyped
71
+ def self.assertion_node: (Parser::AST::Node, AST::Node::TypeAssertion) -> Parser::AST::Node
50
72
 
51
- def without_unrelated_defs: (line: untyped, column: untyped) -> (untyped | self)
73
+ def self.type_application_node: (Parser::AST::Node, AST::Node::TypeApplication) -> Parser::AST::Node
52
74
 
53
- def compact_siblings: (untyped node) -> untyped
75
+ # Returns a line of `selector` of `send` node, that can be used to look up a TypeApplication comment
76
+ #
77
+ def self.sendish_node?: (Parser::AST::Node) -> Integer?
54
78
  end
55
79
  end
@@ -32,8 +32,12 @@ module Steep
32
32
 
33
33
  %a{pure} def module_context: () -> TypeInference::Context::ModuleContext?
34
34
 
35
+ def module_context!: () -> TypeInference::Context::ModuleContext
36
+
35
37
  %a{pure} def method_context: () -> TypeInference::Context::MethodContext?
36
38
 
39
+ def method_context!: () -> TypeInference::Context::MethodContext
40
+
37
41
  %a{pure} def block_context: () -> TypeInference::Context::BlockContext?
38
42
 
39
43
  %a{pure} def break_context: () -> TypeInference::Context::BreakContext?
@@ -130,16 +134,94 @@ module Steep
130
134
 
131
135
  def synthesize_children: (Parser::AST::Node node, ?skips: Array[Parser::AST::Node]) -> TypeConstruction
132
136
 
133
- def type_send_interface: (Parser::AST::Node node, interface: Interface::Shape, receiver: Parser::AST::Node, receiver_type: AST::Types::t, method_name: Symbol, arguments: Array[Parser::AST::Node], block_params: Parser::AST::Node?, block_body: Parser::AST::Node?) -> Pair
137
+ # Synthesize `:send`, `:csend`, `:block`, and `:numblock` node
138
+ #
139
+ def synthesize_sendish: (Parser::AST::Node sendish, hint: AST::Types::t?, tapp: AST::Node::TypeApplication?) -> Pair
140
+
141
+ # The entrypoint to type check method calls, which may be with blocks
142
+ #
143
+ # * `send_node` can be `:send`, `:super`, or `:zsuper`
144
+ # * `node` can be `:send`, `:block`, `:super`, or `:zsuper`
145
+ # * Specify `unwrap` keyword `true` to type check safe-navigation-operator, that unwraps the type of reeiver automatically and make the return type optional
146
+ #
147
+ def type_send: (
148
+ Parser::AST::Node node,
149
+ send_node: Parser::AST::Node,
150
+ block_params: Parser::AST::Node?,
151
+ block_body: Parser::AST::Node?,
152
+ ?unwrap: bool,
153
+ tapp: AST::Node::TypeApplication?
154
+ ) -> Pair
155
+
156
+ # The second step to type check method calls, which handles type refinements on *pure* calls
157
+ #
158
+ # * It receives `interface` keyword, that is the shape of the receiver type
159
+ # * It receives `arguments` keyword, that is an array of argument nodes
160
+ #
161
+ def type_send_interface: (
162
+ Parser::AST::Node node,
163
+ interface: Interface::Shape,
164
+ receiver: Parser::AST::Node?,
165
+ receiver_type: AST::Types::t,
166
+ method_name: Symbol,
167
+ arguments: Array[Parser::AST::Node],
168
+ block_params: Parser::AST::Node?,
169
+ block_body: Parser::AST::Node?,
170
+ tapp: AST::Node::TypeApplication?
171
+ ) -> Pair
172
+
173
+ # The third step to type check method calls, which tries all of the overlods defined for the method
174
+ #
175
+ # * It receives the `Shape::Entry` object that represents an method entry of a shape
176
+ # * Returns `nil` when it cannot find suitable one from more than one overloads
177
+ # * It means the type checker can report only *no suitable overlod detected for this args* 😫
178
+ #
179
+ def type_method_call: (
180
+ Parser::AST::Node node,
181
+ method_name: Symbol,
182
+ receiver_type: AST::Types::t,
183
+ method: Interface::Shape::Entry,
184
+ arguments: Array[Parser::AST::Node],
185
+ block_params: Parser::AST::Node?,
186
+ block_body: Parser::AST::Node?,
187
+ tapp: AST::Node::TypeApplication?
188
+ ) -> [TypeInference::MethodCall::t, TypeConstruction]?
189
+
190
+ # The core to type check method calls, which implements type checking arguments including blocks and type inference
191
+ #
192
+ # * `receiver_type` and `method_name` are only used for error reporting
193
+ #
194
+ def try_method_type: (
195
+ Parser::AST::Node node,
196
+ receiver_type: AST::Types::t,
197
+ method_name: Symbol,
198
+ method_type: Interface::MethodType,
199
+ arguments: Array[Parser::AST::Node],
200
+ block_params: Parser::AST::Node?,
201
+ block_body: Parser::AST::Node?,
202
+ tapp: AST::Node::TypeApplication?
203
+ ) -> [TypeInference::MethodCall::t, TypeConstruction]
134
204
 
135
- def type_send: (untyped node, send_node: untyped, block_params: untyped, block_body: untyped, ?unwrap: bool) -> untyped
205
+ # Extra step to type check method calls, which implements custom typing rules based on the methods
206
+ #
207
+ # * Returns `nil` if the `method_type` object is not associated to a method with custom typing rules
208
+ #
209
+ def try_special_method: (
210
+ Parser::AST::Node node,
211
+ receiver_type: AST::Types::t,
212
+ method_name: Symbol,
213
+ method_type: Interface::MethodType,
214
+ arguments: Array[Parser::AST::Node],
215
+ block_params: Parser::AST::Node?,
216
+ block_body: Parser::AST::Node?
217
+ ) -> [TypeInference::MethodCall::t, TypeConstruction]?
136
218
 
137
219
  def builder_config: () -> Interface::Builder::Config
138
220
 
139
221
  # Calculates the shape (interface) of an type
140
222
  #
141
223
  # * Returns `nil` if the type cannot be translated to a shape
142
- # * Returns Shape::Entry instead of Shape, if `method_name` is given
224
+ # * Returns Shape::Entry instead of Shape when `method_name` is given
143
225
  #
144
226
  def calculate_interface: (AST::Types::t `type`, private: bool) -> Interface::Shape?
145
227
  | (AST::Types::t `type`, Symbol method_name, private: bool) -> Interface::Shape::Entry?
@@ -150,19 +232,6 @@ module Steep
150
232
 
151
233
  KNOWN_PURE_METHODS: Set[method_name]
152
234
 
153
- def try_special_method: (untyped node, receiver_type: untyped, method_name: untyped, method_type: untyped, arguments: untyped, block_params: untyped, block_body: untyped) -> (::Array[untyped] | nil)
154
-
155
- def type_method_call: (
156
- Parser::AST::Node node,
157
- method_name: Symbol,
158
- receiver_type: AST::Types::t,
159
- method: Interface::Shape::Entry,
160
- arguments: Array[Parser::AST::Node],
161
- block_params: Parser::AST::Node?,
162
- block_body: Parser::AST::Node?,
163
- topdown_hint: untyped
164
- ) -> [TypeInference::MethodCall::t, TypeConstruction]?
165
-
166
235
  def inspect: () -> ::String
167
236
 
168
237
  def with_child_typing: [A] (range: Range[Integer]) { (TypeConstruction) -> A } -> A
@@ -186,17 +255,6 @@ module Steep
186
255
 
187
256
  def eliminate_vars: (untyped `type`, untyped variables, ?to: untyped) -> untyped
188
257
 
189
- def try_method_type: (
190
- Parser::AST::Node node,
191
- receiver_type: AST::Types::t,
192
- method_name: Symbol,
193
- method_type: Interface::MethodType,
194
- arguments: Array[Parser::AST::Node],
195
- block_params: Parser::AST::Node?,
196
- block_body: Parser::AST::Node?,
197
- topdown_hint: untyped
198
- ) -> [TypeInference::MethodCall::t, TypeConstruction]
199
-
200
258
  def type_check_args: (
201
259
  TypeInference::SendArgs,
202
260
  Subtyping::Constraints,
@@ -72,7 +72,7 @@ module Steep
72
72
 
73
73
  attr_reader method_decls: Set[MethodDecl]
74
74
 
75
- def initialize: (node: Parser::AST::Node, context: context, method_name: Symbol, receiver_type: AST::Types::t, actual_method_type: Interface::MethodType, method_decls: Array[MethodDecl], return_type: AST::Types::t) -> void
75
+ def initialize: (node: Parser::AST::Node, context: context, method_name: Symbol, receiver_type: AST::Types::t, actual_method_type: Interface::MethodType, method_decls: Set[MethodDecl], return_type: AST::Types::t) -> void
76
76
 
77
77
  def update: (?node: Parser::AST::Node, ?return_type: AST::Types::t) -> self
78
78
 
data/sig/steep.rbs CHANGED
@@ -1,4 +1,6 @@
1
1
  module Steep
2
+ VERSION: String
3
+
2
4
  def self.logger: () -> (Logger & ActiveSupport::TaggedLogging)
3
5
 
4
6
  def self.new_logger: (untyped output, untyped prev_level) -> untyped
@@ -0,0 +1,2 @@
1
+ class InheritModule < Kernel
2
+ end
@@ -46,6 +46,18 @@
46
46
  severity: ERROR
47
47
  message: Different generic parameters are specified across definitions of `::GenericParameterMismatchError::Foo`
48
48
  code: RBS::GenericParameterMismatch
49
+ - file: inherit-module.rbs
50
+ diagnostics:
51
+ - range:
52
+ start:
53
+ line: 1
54
+ character: 22
55
+ end:
56
+ line: 1
57
+ character: -1
58
+ severity: ERROR
59
+ message: Cannot inherit from a module `::Kernel`
60
+ code: RBS::InheritModuleError
49
61
  - file: invalid-method-overload.rbs
50
62
  diagnostics:
51
63
  - range:
data/steep.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
34
34
  spec.add_runtime_dependency "listen", "~> 3.0"
35
35
  spec.add_runtime_dependency "language_server-protocol", ">= 3.15", "< 4.0"
36
- spec.add_runtime_dependency "rbs", ">= 2.7.0"
36
+ spec.add_runtime_dependency "rbs", ">= 2.8.0.pre"
37
37
  spec.add_runtime_dependency "parallel", ">= 1.0.0"
38
38
  spec.add_runtime_dependency "terminal-table", ">= 2", "< 4"
39
39
  spec.add_runtime_dependency "securerandom", ">= 0.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-22 00:00:00.000000000 Z
11
+ date: 2022-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -98,14 +98,14 @@ dependencies:
98
98
  requirements:
99
99
  - - ">="
100
100
  - !ruby/object:Gem::Version
101
- version: 2.7.0
101
+ version: 2.8.0.pre
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
- version: 2.7.0
108
+ version: 2.8.0.pre
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: parallel
111
111
  requirement: !ruby/object:Gem::Requirement
@@ -258,6 +258,8 @@ files:
258
258
  - lib/steep/ast/annotation.rb
259
259
  - lib/steep/ast/annotation/collection.rb
260
260
  - lib/steep/ast/builtin.rb
261
+ - lib/steep/ast/node/type_application.rb
262
+ - lib/steep/ast/node/type_assertion.rb
261
263
  - lib/steep/ast/type_params.rb
262
264
  - lib/steep/ast/types.rb
263
265
  - lib/steep/ast/types/any.rb
@@ -372,16 +374,21 @@ files:
372
374
  - sample/lib/length.rb
373
375
  - sample/sig/conference.rbs
374
376
  - sample/sig/length.rbs
377
+ - sig/shims/exception.rbs
375
378
  - sig/shims/language-server_protocol.rbs
376
379
  - sig/shims/parallel.rbs
377
380
  - sig/shims/parser.rbs
381
+ - sig/shims/parser/comment.rbs
378
382
  - sig/shims/parser/source/map.rbs
379
383
  - sig/shims/parser/source/range.rbs
380
384
  - sig/shims/tagged_logging.rbs
381
385
  - sig/steep.rbs
386
+ - sig/steep/annotation_parser.rbs
382
387
  - sig/steep/ast/annotation.rbs
383
388
  - sig/steep/ast/annotation/collection.rbs
384
389
  - sig/steep/ast/builtin.rbs
390
+ - sig/steep/ast/node/type_application.rbs
391
+ - sig/steep/ast/node/type_assertion.rbs
385
392
  - sig/steep/ast/type_params.rbs
386
393
  - sig/steep/ast/types.rbs
387
394
  - sig/steep/ast/types/any.rbs
@@ -444,6 +451,7 @@ files:
444
451
  - sig/steep/project/options.rbs
445
452
  - sig/steep/project/pattern.rbs
446
453
  - sig/steep/project/target.rbs
454
+ - sig/steep/range_extension.rbs
447
455
  - sig/steep/server/base_worker.rbs
448
456
  - sig/steep/server/change_buffer.rbs
449
457
  - sig/steep/server/interaction_worker.rbs
@@ -462,6 +470,7 @@ files:
462
470
  - sig/steep/services/signature_service.rbs
463
471
  - sig/steep/services/stats_calculator.rbs
464
472
  - sig/steep/services/type_check_service.rbs
473
+ - sig/steep/signature/validator.rbs
465
474
  - sig/steep/source.rbs
466
475
  - sig/steep/subtyping/cache.rbs
467
476
  - sig/steep/subtyping/check.rbs
@@ -537,6 +546,7 @@ files:
537
546
  - smoke/diagnostics-rbs/Steepfile
538
547
  - smoke/diagnostics-rbs/duplicated-method-definition.rbs
539
548
  - smoke/diagnostics-rbs/generic-parameter-mismatch.rbs
549
+ - smoke/diagnostics-rbs/inherit-module.rbs
540
550
  - smoke/diagnostics-rbs/invalid-method-overload.rbs
541
551
  - smoke/diagnostics-rbs/invalid-type-application.rbs
542
552
  - smoke/diagnostics-rbs/invalid_variance_annotation.rbs
@@ -754,9 +764,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
754
764
  version: 2.6.0
755
765
  required_rubygems_version: !ruby/object:Gem::Requirement
756
766
  requirements:
757
- - - ">="
767
+ - - ">"
758
768
  - !ruby/object:Gem::Version
759
- version: '0'
769
+ version: 1.3.1
760
770
  requirements: []
761
771
  rubygems_version: 3.3.7
762
772
  signing_key: