steep 1.4.0.dev.1 → 1.4.0.dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -2
- data/Gemfile +2 -2
- data/Gemfile.lock +13 -15
- data/Gemfile.steep +1 -2
- data/Gemfile.steep.lock +20 -18
- data/README.md +7 -1
- data/Steepfile +16 -3
- data/bin/rbs +0 -1
- data/guides/README.md +5 -0
- data/guides/src/gem-rbs-collection/gem-rbs-collection.md +143 -0
- data/guides/src/getting-started/getting-started.md +164 -0
- data/guides/src/nil-optional/nil-optional.md +195 -0
- data/lib/steep/annotation_parser.rb +40 -20
- data/lib/steep/ast/types/factory.rb +56 -10
- data/lib/steep/ast/types/name.rb +10 -0
- data/lib/steep/diagnostic/ruby.rb +80 -5
- data/lib/steep/diagnostic/signature.rb +40 -0
- data/lib/steep/drivers/check.rb +4 -4
- data/lib/steep/index/rbs_index.rb +12 -3
- data/lib/steep/index/signature_symbol_provider.rb +1 -1
- data/lib/steep/interface/block.rb +10 -0
- data/lib/steep/module_helper.rb +13 -11
- data/lib/steep/path_helper.rb +4 -0
- data/lib/steep/project/target.rb +1 -3
- data/lib/steep/server/interaction_worker.rb +102 -72
- data/lib/steep/server/lsp_formatter.rb +14 -5
- data/lib/steep/services/completion_provider.rb +10 -12
- data/lib/steep/services/goto_service.rb +15 -14
- data/lib/steep/services/hover_provider/rbs.rb +29 -9
- data/lib/steep/services/hover_provider/ruby.rb +16 -10
- data/lib/steep/services/signature_service.rb +36 -39
- data/lib/steep/services/type_name_completion.rb +157 -0
- data/lib/steep/signature/validator.rb +28 -6
- data/lib/steep/source.rb +1 -0
- data/lib/steep/subtyping/check.rb +1 -1
- data/lib/steep/type_construction.rb +414 -239
- data/lib/steep/type_inference/block_params.rb +13 -0
- data/lib/steep/type_inference/constant_env.rb +7 -3
- data/lib/steep/type_inference/context.rb +3 -3
- data/lib/steep/type_inference/method_params.rb +42 -16
- data/lib/steep/type_inference/send_args.rb +79 -50
- data/lib/steep/type_inference/type_env.rb +7 -1
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +1 -0
- data/rbs_collection.steep.lock.yaml +9 -41
- data/rbs_collection.steep.yaml +11 -8
- data/sample/lib/conference.rb +22 -0
- data/sample/sig/conference.rbs +28 -0
- data/sig/shims/language-server_protocol.rbs +12 -0
- data/sig/shims/parser/nodes.rbs +37 -0
- data/sig/shims/parser.rbs +1 -0
- data/sig/shims/string.rbs +4 -0
- data/sig/steep/annotation_parser.rbs +3 -2
- data/sig/steep/ast/annotation/collection.rbs +1 -1
- data/sig/steep/ast/types/factory.rbs +12 -8
- data/sig/steep/ast/types/name.rbs +4 -0
- data/sig/steep/diagnostic/lsp_formatter.rbs +1 -1
- data/sig/steep/diagnostic/ruby.rbs +38 -2
- data/sig/steep/diagnostic/signature.rbs +18 -14
- data/sig/steep/drivers/check.rbs +1 -1
- data/sig/steep/drivers/checkfile.rbs +1 -1
- data/sig/steep/drivers/diagnostic_printer.rbs +1 -1
- data/sig/steep/drivers/watch.rbs +1 -1
- data/sig/steep/index/rbs_index.rbs +6 -2
- data/sig/steep/index/signature_symbol_provider.rbs +1 -1
- data/sig/steep/interface/block.rbs +2 -0
- data/sig/steep/interface/builder.rbs +5 -3
- data/sig/steep/interface/method_type.rbs +5 -3
- data/sig/steep/module_helper.rbs +9 -0
- data/sig/steep/path_helper.rbs +3 -1
- data/sig/steep/project/target.rbs +7 -7
- data/sig/steep/server/base_worker.rbs +1 -1
- data/sig/steep/server/interaction_worker.rbs +46 -17
- data/sig/steep/server/lsp_formatter.rbs +4 -2
- data/sig/steep/server/master.rbs +1 -1
- data/sig/steep/server/type_check_worker.rbs +7 -5
- data/sig/steep/server/worker_process.rbs +6 -4
- data/sig/steep/services/completion_provider.rbs +8 -0
- data/sig/steep/services/hover_provider/rbs.rbs +6 -4
- data/sig/steep/services/hover_provider/ruby.rbs +8 -4
- data/sig/steep/services/signature_service.rbs +27 -3
- data/sig/steep/services/type_name_completion.rbs +122 -0
- data/sig/steep/signature/validator.rbs +9 -5
- data/sig/steep/type_construction.rbs +100 -31
- data/sig/steep/type_inference/block_params.rbs +4 -0
- data/sig/steep/type_inference/constant_env.rbs +2 -0
- data/sig/steep/type_inference/context.rbs +70 -22
- data/sig/steep/type_inference/method_params.rbs +43 -24
- data/sig/steep/type_inference/multiple_assignment.rbs +1 -1
- data/sig/steep/type_inference/send_args.rbs +13 -3
- data/sig/steep/typing.rbs +7 -2
- data/smoke/diagnostics/test_expectations.yml +1 -0
- data/smoke/regexp/a.rb +2 -2
- data/steep.gemspec +0 -1
- metadata +11 -17
|
@@ -1,31 +1,45 @@
|
|
|
1
|
+
use Steep::Interface::Function::Params, Steep::Interface::Block
|
|
2
|
+
|
|
1
3
|
module Steep
|
|
2
4
|
module TypeInference
|
|
5
|
+
# Type checking context
|
|
3
6
|
class Context
|
|
7
|
+
# Information about the method which the body is being type checked
|
|
8
|
+
#
|
|
4
9
|
class MethodContext
|
|
10
|
+
# Name of the method
|
|
5
11
|
attr_reader name: Symbol?
|
|
6
12
|
|
|
13
|
+
# `nil` when RBS doesn't have the corresponding method definition
|
|
7
14
|
attr_reader method: RBS::Definition::Method?
|
|
8
15
|
|
|
16
|
+
# `nil` when no method type is given
|
|
9
17
|
attr_reader method_type: Interface::MethodType?
|
|
10
18
|
|
|
19
|
+
# Falls back to `untyped`
|
|
11
20
|
attr_reader return_type: AST::Types::t
|
|
12
21
|
|
|
13
|
-
|
|
14
|
-
|
|
22
|
+
# The *super* method if identified
|
|
15
23
|
attr_reader super_method: RBS::Definition::Method?
|
|
16
24
|
|
|
25
|
+
# The type of forwarding params when `...` is given
|
|
26
|
+
attr_reader forward_arg_type: [Params, Block?]?
|
|
27
|
+
|
|
17
28
|
def initialize: (
|
|
18
29
|
name: Symbol,
|
|
19
30
|
method: RBS::Definition::Method?,
|
|
20
31
|
method_type: Interface::MethodType?,
|
|
21
32
|
return_type: AST::Types::t,
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
super_method: RBS::Definition::Method?,
|
|
34
|
+
forward_arg_type: [Params, Block?]?
|
|
24
35
|
) -> void
|
|
25
36
|
|
|
37
|
+
# Type of the block of the current method type
|
|
26
38
|
def block_type: () -> Interface::Block?
|
|
27
39
|
end
|
|
28
40
|
|
|
41
|
+
# Information about the block which the body is being type checked
|
|
42
|
+
#
|
|
29
43
|
class BlockContext
|
|
30
44
|
# The type of block itself
|
|
31
45
|
#
|
|
@@ -38,6 +52,7 @@ module Steep
|
|
|
38
52
|
def subst: (Interface::Substitution) -> BlockContext
|
|
39
53
|
end
|
|
40
54
|
|
|
55
|
+
# Context about the `break` syntax
|
|
41
56
|
class BreakContext
|
|
42
57
|
# Type of arguments to `break` statement
|
|
43
58
|
#
|
|
@@ -54,23 +69,40 @@ module Steep
|
|
|
54
69
|
def subst: (Interface::Substitution) -> BreakContext
|
|
55
70
|
end
|
|
56
71
|
|
|
72
|
+
# Information about the module which the body is being type checked
|
|
73
|
+
#
|
|
57
74
|
class ModuleContext
|
|
75
|
+
# The type of an instance of current module
|
|
58
76
|
attr_reader instance_type: AST::Types::t
|
|
59
77
|
|
|
78
|
+
# The type of singleton of current module
|
|
60
79
|
attr_reader module_type: AST::Types::t
|
|
61
80
|
|
|
62
|
-
|
|
81
|
+
# The set of name of instance methods that is defined in the `module`/`class` statement
|
|
82
|
+
attr_reader defined_instance_methods: Set[Symbol]
|
|
63
83
|
|
|
64
|
-
|
|
84
|
+
# The set of name of singleton methods that is defined in the `module`/`class` statement
|
|
85
|
+
attr_reader defined_module_methods: Set[Symbol]
|
|
65
86
|
|
|
87
|
+
# The nesting of current module
|
|
88
|
+
#
|
|
89
|
+
# Cannot be `nil`.
|
|
90
|
+
#
|
|
66
91
|
attr_reader nesting: RBS::Resolver::context
|
|
67
92
|
|
|
68
|
-
|
|
93
|
+
# The name that is given to `@implements` annotation
|
|
94
|
+
#
|
|
95
|
+
# `nil` when no `@implements` annotation is given.
|
|
96
|
+
#
|
|
97
|
+
attr_reader implement_name: AST::Annotation::Implements::Module?
|
|
69
98
|
|
|
99
|
+
# The name of the class/module.
|
|
70
100
|
attr_reader class_name: RBS::TypeName
|
|
71
101
|
|
|
102
|
+
# The definition of the instance of the module
|
|
72
103
|
attr_reader instance_definition: RBS::Definition?
|
|
73
104
|
|
|
105
|
+
# The definition of the singleton of the module
|
|
74
106
|
attr_reader module_definition: RBS::Definition?
|
|
75
107
|
|
|
76
108
|
@class_variables: Hash[Symbol, RBS::Types::t]?
|
|
@@ -78,19 +110,20 @@ module Steep
|
|
|
78
110
|
def initialize: (
|
|
79
111
|
instance_type: AST::Types::t,
|
|
80
112
|
module_type: AST::Types::t,
|
|
81
|
-
implement_name:
|
|
113
|
+
implement_name: AST::Annotation::Implements::Module?,
|
|
82
114
|
class_name: RBS::TypeName,
|
|
83
115
|
nesting: RBS::Resolver::context,
|
|
84
116
|
?instance_definition: RBS::Definition?,
|
|
85
117
|
?module_definition: RBS::Definition?
|
|
86
118
|
) -> void
|
|
87
119
|
|
|
88
|
-
|
|
120
|
+
# Returns a hash from the name of a class variable to its type
|
|
121
|
+
%a{pure} def class_variables: () -> Hash[Symbol, RBS::Types::t]?
|
|
89
122
|
|
|
90
123
|
def update: (
|
|
91
124
|
?instance_type: AST::Types::t,
|
|
92
125
|
?module_type: AST::Types::t,
|
|
93
|
-
?implement_name:
|
|
126
|
+
?implement_name: AST::Annotation::Implements::Module?,
|
|
94
127
|
?class_name: RBS::TypeName,
|
|
95
128
|
?instance_definition: RBS::Definition?,
|
|
96
129
|
?module_definition: RBS::Definition?,
|
|
@@ -98,6 +131,8 @@ module Steep
|
|
|
98
131
|
) -> ModuleContext
|
|
99
132
|
end
|
|
100
133
|
|
|
134
|
+
# Information about the free type variables
|
|
135
|
+
#
|
|
101
136
|
class TypeVariableContext
|
|
102
137
|
attr_reader table: Hash[Symbol, Interface::TypeParam]
|
|
103
138
|
|
|
@@ -105,6 +140,7 @@ module Steep
|
|
|
105
140
|
|
|
106
141
|
def initialize: (Array[Interface::TypeParam] type_params, ?parent_context: TypeVariableContext?) -> void
|
|
107
142
|
|
|
143
|
+
# Returns the upper bound of a type variable
|
|
108
144
|
def []: (Symbol name) -> AST::Types::t?
|
|
109
145
|
|
|
110
146
|
def upper_bounds: () -> Hash[Symbol, AST::Types::t]
|
|
@@ -112,9 +148,14 @@ module Steep
|
|
|
112
148
|
def self.empty: () -> TypeVariableContext
|
|
113
149
|
end
|
|
114
150
|
|
|
115
|
-
|
|
151
|
+
# The caller where a method is called from
|
|
152
|
+
attr_reader call_context: MethodCall::context
|
|
116
153
|
|
|
117
|
-
|
|
154
|
+
# MethodContext for current execution point
|
|
155
|
+
#
|
|
156
|
+
# `nil` when not in any method definition.
|
|
157
|
+
#
|
|
158
|
+
attr_reader method_context: MethodContext?
|
|
118
159
|
|
|
119
160
|
# BlockContext for current execution point
|
|
120
161
|
#
|
|
@@ -122,10 +163,17 @@ module Steep
|
|
|
122
163
|
#
|
|
123
164
|
attr_reader block_context: BlockContext?
|
|
124
165
|
|
|
166
|
+
# BreakContext for current execution point
|
|
167
|
+
#
|
|
168
|
+
# `nil` if `break` is not allowed.
|
|
169
|
+
#
|
|
125
170
|
attr_reader break_context: BreakContext?
|
|
126
171
|
|
|
127
|
-
|
|
172
|
+
# ModuleContext for current execution point
|
|
173
|
+
attr_reader module_context: ModuleContext
|
|
128
174
|
|
|
175
|
+
# The type of `self`
|
|
176
|
+
#
|
|
129
177
|
attr_reader self_type: AST::Types::t
|
|
130
178
|
|
|
131
179
|
attr_reader type_env: TypeEnv
|
|
@@ -133,25 +181,25 @@ module Steep
|
|
|
133
181
|
attr_reader variable_context: TypeVariableContext
|
|
134
182
|
|
|
135
183
|
def initialize: (
|
|
136
|
-
method_context:
|
|
184
|
+
method_context: MethodContext?,
|
|
137
185
|
block_context: BlockContext?,
|
|
138
186
|
break_context: BreakContext?,
|
|
139
|
-
module_context: ModuleContext
|
|
140
|
-
self_type:
|
|
187
|
+
module_context: ModuleContext,
|
|
188
|
+
self_type: AST::Types::t,
|
|
141
189
|
type_env: TypeEnv,
|
|
142
|
-
call_context:
|
|
190
|
+
call_context: MethodCall::context,
|
|
143
191
|
variable_context: TypeVariableContext
|
|
144
192
|
) -> void
|
|
145
193
|
|
|
146
194
|
def with: (
|
|
147
|
-
?method_context:
|
|
195
|
+
?method_context: MethodContext?,
|
|
148
196
|
?block_context: BlockContext?,
|
|
149
197
|
?break_context: BreakContext?,
|
|
150
|
-
?module_context: ModuleContext
|
|
151
|
-
?self_type:
|
|
198
|
+
?module_context: ModuleContext,
|
|
199
|
+
?self_type: AST::Types::t,
|
|
152
200
|
?type_env: TypeEnv,
|
|
153
|
-
?call_context:
|
|
154
|
-
?variable_context:
|
|
201
|
+
?call_context: MethodCall::context,
|
|
202
|
+
?variable_context: TypeVariableContext
|
|
155
203
|
) -> Context
|
|
156
204
|
|
|
157
205
|
def factory: () -> AST::Types::Factory
|
|
@@ -1,24 +1,31 @@
|
|
|
1
|
+
use Parser::AST::Node, Steep::Interface::MethodType
|
|
2
|
+
use Steep::Interface::Function::Params, Steep::Interface::Block
|
|
3
|
+
|
|
1
4
|
module Steep
|
|
2
5
|
module TypeInference
|
|
6
|
+
# A MethodParams object provides the information of parameters from MethodType and nodes
|
|
7
|
+
#
|
|
8
|
+
# It primarly provides a mapping from a local variable (method parameter) to its type.
|
|
9
|
+
#
|
|
3
10
|
class MethodParams
|
|
4
11
|
class BaseParameter
|
|
5
12
|
attr_reader name: Symbol
|
|
6
13
|
|
|
7
|
-
attr_reader type:
|
|
14
|
+
attr_reader type: AST::Types::t?
|
|
8
15
|
|
|
9
|
-
attr_reader node:
|
|
16
|
+
attr_reader node: Node
|
|
10
17
|
|
|
11
|
-
def initialize: (name: Symbol, type:
|
|
18
|
+
def initialize: (name: Symbol, type: AST::Types::t?, node: Node) -> void
|
|
12
19
|
|
|
13
20
|
def optional?: () -> bool
|
|
14
21
|
|
|
15
|
-
def value: () ->
|
|
22
|
+
def value: () -> Node?
|
|
16
23
|
|
|
17
24
|
def var_type: () -> AST::Types::t
|
|
18
25
|
|
|
19
26
|
def untyped?: () -> bool
|
|
20
27
|
|
|
21
|
-
def ==: (untyped other) ->
|
|
28
|
+
def ==: (untyped other) -> bool
|
|
22
29
|
|
|
23
30
|
alias eql? ==
|
|
24
31
|
|
|
@@ -34,27 +41,25 @@ module Steep
|
|
|
34
41
|
class BaseRestParameter
|
|
35
42
|
attr_reader name: Symbol
|
|
36
43
|
|
|
37
|
-
attr_reader type:
|
|
44
|
+
attr_reader type: AST::Types::t?
|
|
38
45
|
|
|
39
|
-
attr_reader node:
|
|
46
|
+
attr_reader node: Node
|
|
40
47
|
|
|
41
|
-
def initialize: (name: Symbol, type:
|
|
48
|
+
def initialize: (name: Symbol, type: AST::Types::t?, node: Node) -> void
|
|
42
49
|
|
|
43
50
|
def ==: (untyped other) -> bool
|
|
44
51
|
|
|
45
52
|
alias eql? ==
|
|
46
53
|
|
|
47
54
|
def hash: () -> Integer
|
|
48
|
-
|
|
49
|
-
def var_type: () -> AST::Types::t
|
|
50
55
|
end
|
|
51
56
|
|
|
52
57
|
class PositionalRestParameter < BaseRestParameter
|
|
53
|
-
def var_type: () -> AST::Types::
|
|
58
|
+
def var_type: () -> AST::Types::Name::Instance
|
|
54
59
|
end
|
|
55
60
|
|
|
56
61
|
class KeywordRestParameter < BaseRestParameter
|
|
57
|
-
def var_type: () -> AST::Types::
|
|
62
|
+
def var_type: () -> AST::Types::Name::Instance
|
|
58
63
|
end
|
|
59
64
|
|
|
60
65
|
class BlockParameter
|
|
@@ -62,11 +67,11 @@ module Steep
|
|
|
62
67
|
|
|
63
68
|
attr_reader type: Interface::Function?
|
|
64
69
|
|
|
65
|
-
attr_reader node:
|
|
70
|
+
attr_reader node: Node
|
|
66
71
|
|
|
67
72
|
attr_reader self_type: AST::Types::t?
|
|
68
73
|
|
|
69
|
-
def initialize: (name: Symbol, type: Interface::Function?, node:
|
|
74
|
+
def initialize: (name: Symbol, type: Interface::Function?, node: Node, optional: boolish, self_type: AST::Types::t?) -> void
|
|
70
75
|
|
|
71
76
|
@optional: boolish
|
|
72
77
|
|
|
@@ -81,28 +86,42 @@ module Steep
|
|
|
81
86
|
def hash: () -> Integer
|
|
82
87
|
end
|
|
83
88
|
|
|
84
|
-
|
|
89
|
+
type param = PositionalParameter | KeywordParameter | PositionalRestParameter | KeywordRestParameter | BlockParameter
|
|
90
|
+
|
|
91
|
+
# The children of `:args` node
|
|
92
|
+
attr_reader args: Array[Node]
|
|
93
|
+
|
|
94
|
+
attr_reader method_type: MethodType?
|
|
85
95
|
|
|
86
|
-
|
|
96
|
+
# Mapping from the name of parameter to parameter object
|
|
97
|
+
attr_reader params: Hash[Symbol, param]
|
|
87
98
|
|
|
88
|
-
attr_reader
|
|
99
|
+
attr_reader errors: Array[Diagnostic::Ruby::Base]
|
|
89
100
|
|
|
90
|
-
|
|
101
|
+
# The type of `...`
|
|
102
|
+
#
|
|
103
|
+
# `nil` if the node doesn't have it.
|
|
104
|
+
#
|
|
105
|
+
attr_reader forward_arg_type: [Params, Block?]?
|
|
91
106
|
|
|
92
|
-
def initialize: (args:
|
|
107
|
+
def initialize: (args: Array[Node], method_type: MethodType?, forward_arg_type: [Params, Block?]?) -> void
|
|
93
108
|
|
|
94
|
-
def []: (
|
|
109
|
+
def []: (Symbol name) -> param
|
|
110
|
+
|
|
111
|
+
def param?: (Symbol) -> bool
|
|
95
112
|
|
|
96
113
|
def size: () -> Integer
|
|
97
114
|
|
|
98
|
-
def each_param: () { (
|
|
99
|
-
| () -> Enumerator[
|
|
115
|
+
def each_param: () { (param) -> void } -> void
|
|
116
|
+
| () -> Enumerator[param, void]
|
|
100
117
|
|
|
101
118
|
def each: () { (Symbol, AST::Types::t) -> void } -> void
|
|
102
119
|
|
|
103
|
-
def
|
|
120
|
+
def update: (?forward_arg_type: [Params, Block?]?) -> MethodParams
|
|
121
|
+
|
|
122
|
+
def self.empty: (node: Node) -> MethodParams
|
|
104
123
|
|
|
105
|
-
def self.build: (node:
|
|
124
|
+
def self.build: (node: Node, method_type: MethodType) -> MethodParams
|
|
106
125
|
end
|
|
107
126
|
end
|
|
108
127
|
end
|
|
@@ -59,7 +59,7 @@ module Steep
|
|
|
59
59
|
# Returns a type hint for multiple assignment right hand side
|
|
60
60
|
#
|
|
61
61
|
# It constructs a structure of tuple types, based on the assignment lhs, and variable types.
|
|
62
|
-
#
|
|
62
|
+
#
|
|
63
63
|
def hint_for_mlhs: (Parser::AST::Node mlhs, TypeEnv env) -> AST::Types::t?
|
|
64
64
|
|
|
65
65
|
private
|
|
@@ -68,7 +68,7 @@ module Steep
|
|
|
68
68
|
|
|
69
69
|
def following_args: () -> Array[Parser::AST::Node]
|
|
70
70
|
|
|
71
|
-
def param: () -> Interface::Function::Params::PositionalParams::param?
|
|
71
|
+
%a{pure} def param: () -> Interface::Function::Params::PositionalParams::param?
|
|
72
72
|
|
|
73
73
|
def update: (?index: Integer, ?positional_params: Interface::Function::Params::PositionalParams?, ?uniform: bool) -> PositionalArgs
|
|
74
74
|
|
|
@@ -198,6 +198,14 @@ module Steep
|
|
|
198
198
|
def node_type: () -> AST::Types::t
|
|
199
199
|
end
|
|
200
200
|
|
|
201
|
+
class ForwardedArgs
|
|
202
|
+
attr_reader node: Parser::AST::Node
|
|
203
|
+
|
|
204
|
+
attr_reader params: Interface::Function::Params
|
|
205
|
+
|
|
206
|
+
def initialize: (node: Parser::AST::Node, params: Interface::Function::Params) -> void
|
|
207
|
+
end
|
|
208
|
+
|
|
201
209
|
attr_reader node: Parser::AST::Node
|
|
202
210
|
|
|
203
211
|
attr_reader arguments: Array[Parser::AST::Node]
|
|
@@ -216,14 +224,16 @@ module Steep
|
|
|
216
224
|
|
|
217
225
|
def kwargs_node: () -> Parser::AST::Node?
|
|
218
226
|
|
|
227
|
+
def forwarded_args_node: () -> Parser::AST::Node?
|
|
228
|
+
|
|
219
229
|
def positional_arg: () -> PositionalArgs
|
|
220
230
|
|
|
221
231
|
def keyword_args: () -> KeywordArgs
|
|
222
232
|
|
|
223
233
|
def block_pass_arg: () -> BlockPassArg
|
|
224
234
|
|
|
225
|
-
def each: () { (PositionalArgs::arg | KeywordArgs::arg) -> void } -> Array[Diagnostic::Ruby::Base]
|
|
226
|
-
| () -> Enumerator[PositionalArgs::arg | KeywordArgs::arg, Array[Diagnostic::Ruby::Base]]
|
|
235
|
+
def each: () { (PositionalArgs::arg | KeywordArgs::arg) -> void } -> [ForwardedArgs?, Array[Diagnostic::Ruby::Base]]
|
|
236
|
+
| () -> Enumerator[PositionalArgs::arg | KeywordArgs::arg, [ForwardedArgs?, Array[Diagnostic::Ruby::Base]]]
|
|
227
237
|
end
|
|
228
238
|
end
|
|
229
239
|
end
|
data/sig/steep/typing.rbs
CHANGED
|
@@ -34,7 +34,7 @@ module Steep
|
|
|
34
34
|
|
|
35
35
|
def add_error: (Diagnostic::Ruby::Base error) -> void
|
|
36
36
|
|
|
37
|
-
def add_typing: (Parser::AST::Node node, AST::Types::t `type`,
|
|
37
|
+
def add_typing: (Parser::AST::Node node, AST::Types::t `type`, top) -> untyped
|
|
38
38
|
|
|
39
39
|
def add_call: (untyped node, untyped call) -> untyped
|
|
40
40
|
|
|
@@ -61,8 +61,13 @@ module Steep
|
|
|
61
61
|
def new_child: [A] (Range[Integer] range) { (Typing) -> A } -> A
|
|
62
62
|
| (Range[Integer]) -> Typing
|
|
63
63
|
|
|
64
|
-
def each_typing: () { () ->
|
|
64
|
+
def each_typing: () { (Parser::AST::Node, AST::Types::t) -> void } -> void
|
|
65
65
|
|
|
66
|
+
# Push the current changes to the `#parent` typing
|
|
67
|
+
#
|
|
68
|
+
# * Raises an error if `#parent` is `nil`
|
|
69
|
+
# * Raises an error if `#parent` is changed since `#new_child` call that instantiated `self`
|
|
70
|
+
#
|
|
66
71
|
def save!: () -> void
|
|
67
72
|
end
|
|
68
73
|
end
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
message: |-
|
|
47
47
|
Cannot pass a value of type `^(untyped, untyped, untyped) -> untyped` as a block-pass-argument of type `^(::Integer) -> void`
|
|
48
48
|
^(untyped, untyped, untyped) -> untyped <: ^(::Integer) -> void
|
|
49
|
+
(Params are incompatible)
|
|
49
50
|
code: Ruby::BlockTypeMismatch
|
|
50
51
|
- file: break_type_mismatch.rb
|
|
51
52
|
diagnostics:
|
data/smoke/regexp/a.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
new_1 = Regexp.new("a")
|
|
2
2
|
new_1.foo
|
|
3
3
|
|
|
4
|
-
new_2 = Regexp.new("a",
|
|
4
|
+
new_2 = Regexp.new("a", nil)
|
|
5
5
|
new_2.foo
|
|
6
6
|
|
|
7
7
|
new_3 = Regexp.new("a", Regexp::EXTENDED | Regexp::IGNORECASE)
|
|
@@ -13,7 +13,7 @@ new_4.foo
|
|
|
13
13
|
compile_1 = Regexp.compile("a")
|
|
14
14
|
compile_1.foo
|
|
15
15
|
|
|
16
|
-
compile_2 = Regexp.compile("a",
|
|
16
|
+
compile_2 = Regexp.compile("a", false)
|
|
17
17
|
compile_2.foo
|
|
18
18
|
|
|
19
19
|
compile_3 = Regexp.compile("a", Regexp::EXTENDED | Regexp::IGNORECASE)
|
data/steep.gemspec
CHANGED
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.4.0.dev.
|
|
4
|
+
version: 1.4.0.dev.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Soutaro Matsumoto
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-04-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: parser
|
|
@@ -224,20 +224,6 @@ dependencies:
|
|
|
224
224
|
- - ">="
|
|
225
225
|
- !ruby/object:Gem::Version
|
|
226
226
|
version: 3.0.9
|
|
227
|
-
- !ruby/object:Gem::Dependency
|
|
228
|
-
name: pathname
|
|
229
|
-
requirement: !ruby/object:Gem::Requirement
|
|
230
|
-
requirements:
|
|
231
|
-
- - ">="
|
|
232
|
-
- !ruby/object:Gem::Version
|
|
233
|
-
version: 0.2.1
|
|
234
|
-
type: :runtime
|
|
235
|
-
prerelease: false
|
|
236
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
237
|
-
requirements:
|
|
238
|
-
- - ">="
|
|
239
|
-
- !ruby/object:Gem::Version
|
|
240
|
-
version: 0.2.1
|
|
241
227
|
description: Gradual Typing for Ruby
|
|
242
228
|
email:
|
|
243
229
|
- matsumoto@soutaro.com
|
|
@@ -268,6 +254,10 @@ files:
|
|
|
268
254
|
- bin/steep
|
|
269
255
|
- bin/steep-prof
|
|
270
256
|
- exe/steep
|
|
257
|
+
- guides/README.md
|
|
258
|
+
- guides/src/gem-rbs-collection/gem-rbs-collection.md
|
|
259
|
+
- guides/src/getting-started/getting-started.md
|
|
260
|
+
- guides/src/nil-optional/nil-optional.md
|
|
271
261
|
- lib/steep.rb
|
|
272
262
|
- lib/steep/annotation_parser.rb
|
|
273
263
|
- lib/steep/ast/annotation.rb
|
|
@@ -356,6 +346,7 @@ files:
|
|
|
356
346
|
- lib/steep/services/signature_service.rb
|
|
357
347
|
- lib/steep/services/stats_calculator.rb
|
|
358
348
|
- lib/steep/services/type_check_service.rb
|
|
349
|
+
- lib/steep/services/type_name_completion.rb
|
|
359
350
|
- lib/steep/shims/filter_map.rb
|
|
360
351
|
- lib/steep/shims/symbol_start_with.rb
|
|
361
352
|
- lib/steep/signature/validator.rb
|
|
@@ -393,8 +384,10 @@ files:
|
|
|
393
384
|
- sig/shims/parallel.rbs
|
|
394
385
|
- sig/shims/parser.rbs
|
|
395
386
|
- sig/shims/parser/comment.rbs
|
|
387
|
+
- sig/shims/parser/nodes.rbs
|
|
396
388
|
- sig/shims/parser/source/map.rbs
|
|
397
389
|
- sig/shims/parser/source/range.rbs
|
|
390
|
+
- sig/shims/string.rbs
|
|
398
391
|
- sig/shims/tagged_logging.rbs
|
|
399
392
|
- sig/steep.rbs
|
|
400
393
|
- sig/steep/annotation_parser.rbs
|
|
@@ -484,6 +477,7 @@ files:
|
|
|
484
477
|
- sig/steep/services/signature_service.rbs
|
|
485
478
|
- sig/steep/services/stats_calculator.rbs
|
|
486
479
|
- sig/steep/services/type_check_service.rbs
|
|
480
|
+
- sig/steep/services/type_name_completion.rbs
|
|
487
481
|
- sig/steep/signature/validator.rbs
|
|
488
482
|
- sig/steep/source.rbs
|
|
489
483
|
- sig/steep/subtyping/cache.rbs
|
|
@@ -782,7 +776,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
782
776
|
- !ruby/object:Gem::Version
|
|
783
777
|
version: 1.3.1
|
|
784
778
|
requirements: []
|
|
785
|
-
rubygems_version: 3.
|
|
779
|
+
rubygems_version: 3.4.6
|
|
786
780
|
signing_key:
|
|
787
781
|
specification_version: 4
|
|
788
782
|
summary: Gradual Typing for Ruby
|