steep 1.7.0.dev.1 → 1.7.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/Gemfile.lock +13 -15
- data/Rakefile +5 -0
- data/gemfile_steep/Gemfile +1 -1
- data/gemfile_steep/Gemfile.lock +11 -13
- data/lib/steep/ast/types/helper.rb +4 -0
- data/lib/steep/ast/types/intersection.rb +7 -0
- data/lib/steep/ast/types/record.rb +7 -0
- data/lib/steep/ast/types/tuple.rb +7 -0
- data/lib/steep/ast/types/union.rb +7 -0
- data/lib/steep/drivers/stats.rb +2 -2
- data/lib/steep/drivers/validate.rb +4 -2
- data/lib/steep/expectations.rb +2 -2
- data/lib/steep/interface/builder.rb +336 -360
- data/lib/steep/interface/function.rb +69 -6
- data/lib/steep/interface/method_type.rb +3 -3
- data/lib/steep/interface/shape.rb +69 -18
- data/lib/steep/interface/substitution.rb +4 -0
- data/lib/steep/node_helper.rb +18 -1
- data/lib/steep/services/completion_provider.rb +19 -17
- data/lib/steep/services/signature_help_provider.rb +19 -20
- data/lib/steep/subtyping/check.rb +10 -16
- data/lib/steep/subtyping/result.rb +6 -0
- data/lib/steep/test.rb +9 -0
- data/lib/steep/type_construction.rb +13 -13
- data/lib/steep/type_inference/block_params.rb +11 -3
- data/lib/steep/type_inference/context.rb +1 -1
- data/lib/steep/type_inference/logic_type_interpreter.rb +1 -1
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +11 -7
- data/sig/steep/ast/types/helper.rbs +2 -0
- data/sig/steep/ast/types/intersection.rbs +2 -0
- data/sig/steep/ast/types/name.rbs +4 -0
- data/sig/steep/ast/types/record.rbs +2 -0
- data/sig/steep/ast/types/tuple.rbs +2 -0
- data/sig/steep/ast/types/union.rbs +2 -0
- data/sig/steep/expectations.rbs +1 -1
- data/sig/steep/interface/block.rbs +2 -2
- data/sig/steep/interface/builder.rbs +94 -108
- data/sig/steep/interface/function.rbs +34 -29
- data/sig/steep/interface/shape.rbs +23 -4
- data/sig/steep/interface/substitution.rbs +2 -0
- data/sig/steep/node_helper.rbs +11 -0
- data/sig/steep/services/signature_help_provider.rbs +2 -0
- data/sig/steep/subtyping/check.rbs +2 -0
- data/sig/steep/subtyping/constraints.rbs +2 -2
- data/sig/steep/subtyping/result.rbs +5 -1
- data/sig/steep/type_construction.rbs +1 -1
- data/sig/steep/type_inference/block_params.rbs +2 -2
- data/sig/steep/type_inference/context.rbs +2 -0
- data/sig/steep.rbs +1 -1
- metadata +3 -3
- data/sig/steep/type_inference/branch.rbs +0 -15
@@ -27,6 +27,7 @@ module Steep
|
|
27
27
|
def var_type: () -> AST::Types::t
|
28
28
|
|
29
29
|
def map_type: () { (AST::Types::t) -> AST::Types::t } -> self
|
30
|
+
| () -> Enumerator[AST::Types::t, void]
|
30
31
|
end
|
31
32
|
|
32
33
|
class Required < Base
|
@@ -57,6 +58,7 @@ module Steep
|
|
57
58
|
def map: () { (param) -> param } -> PositionalParams
|
58
59
|
|
59
60
|
def map_type: () { (AST::Types::t) -> AST::Types::t } -> PositionalParams
|
61
|
+
| () -> Enumerator[AST::Types::t, void]
|
60
62
|
|
61
63
|
def subst: (Substitution s) -> PositionalParams
|
62
64
|
|
@@ -74,13 +76,13 @@ module Steep
|
|
74
76
|
|
75
77
|
def size: () -> Integer
|
76
78
|
|
77
|
-
def self.build: (required: Array[AST::Types::t], optional: Array[AST::Types::t], rest: AST::Types::t?) -> PositionalParams
|
79
|
+
def self.build: (required: Array[AST::Types::t], optional: Array[AST::Types::t], rest: AST::Types::t?) -> PositionalParams?
|
78
80
|
|
79
81
|
extend Utils
|
80
82
|
|
81
83
|
# Calculates xs + ys.
|
82
84
|
# Never fails.
|
83
|
-
def self.merge_for_overload: (PositionalParams? xs, PositionalParams? ys) -> PositionalParams
|
85
|
+
def self.merge_for_overload: (PositionalParams? xs, PositionalParams? ys) -> PositionalParams?
|
84
86
|
|
85
87
|
# xs | ys
|
86
88
|
def self.merge_for_union: (PositionalParams? xs, PositionalParams? ys) -> PositionalParams?
|
@@ -98,15 +100,15 @@ module Steep
|
|
98
100
|
|
99
101
|
attr_reader rest: AST::Types::t?
|
100
102
|
|
101
|
-
def initialize: (?requireds: ::Hash[
|
103
|
+
def initialize: (?requireds: ::Hash[Symbol, AST::Types::t], ?optionals: ::Hash[Symbol, AST::Types::t], ?rest: AST::Types::t?) -> void
|
102
104
|
|
103
|
-
def ==: (untyped other) ->
|
105
|
+
def ==: (untyped other) -> bool
|
104
106
|
|
105
107
|
alias eql? ==
|
106
108
|
|
107
|
-
def hash: () ->
|
109
|
+
def hash: () -> Integer
|
108
110
|
|
109
|
-
def update: (?requireds:
|
111
|
+
def update: (?requireds: Hash[Symbol, AST::Types::t], ?optionals: Hash[Symbol, AST::Types::t], ?rest: AST::Types::t?) -> KeywordParams
|
110
112
|
|
111
113
|
def empty?: () -> bool
|
112
114
|
|
@@ -117,6 +119,7 @@ module Steep
|
|
117
119
|
| () -> Enumerator[AST::Types::t, void]
|
118
120
|
|
119
121
|
def map_type: () { (AST::Types::t) -> AST::Types::t } -> KeywordParams
|
122
|
+
| () -> Enumerator[AST::Types::t, KeywordParams]
|
120
123
|
|
121
124
|
def subst: (Substitution s) -> KeywordParams
|
122
125
|
|
@@ -127,13 +130,13 @@ module Steep
|
|
127
130
|
include Utils
|
128
131
|
|
129
132
|
# For overloading
|
130
|
-
def +: (
|
133
|
+
def +: (KeywordParams other) -> KeywordParams
|
131
134
|
|
132
135
|
# For union
|
133
|
-
def |: (
|
136
|
+
def |: (KeywordParams other) -> KeywordParams
|
134
137
|
|
135
138
|
# For intersection
|
136
|
-
def &: (
|
139
|
+
def &: (KeywordParams other) -> KeywordParams?
|
137
140
|
end
|
138
141
|
|
139
142
|
def required: () -> Array[AST::Types::t]
|
@@ -146,54 +149,55 @@ module Steep
|
|
146
149
|
|
147
150
|
attr_reader keyword_params: KeywordParams
|
148
151
|
|
149
|
-
def self.build: (?required:
|
152
|
+
def self.build: (?required: Array[AST::Types::t], ?optional: Array[AST::Types::t], ?rest: AST::Types::t?, ?required_keywords: ::Hash[Symbol, AST::Types::t], ?optional_keywords: ::Hash[Symbol, AST::Types::t], ?rest_keywords: AST::Types::t?) -> Params
|
150
153
|
|
151
|
-
def initialize: (positional_params:
|
154
|
+
def initialize: (positional_params: PositionalParams?, keyword_params: KeywordParams) -> void
|
152
155
|
|
153
|
-
def update: (?positional_params:
|
156
|
+
def update: (?positional_params: PositionalParams?, ?keyword_params: KeywordParams) -> Params
|
154
157
|
|
155
|
-
def first_param: () ->
|
158
|
+
def first_param: () -> PositionalParams::param?
|
156
159
|
|
157
|
-
def with_first_param: (
|
160
|
+
def with_first_param: (PositionalParams::param) -> Params
|
158
161
|
|
159
|
-
def has_positional?: () ->
|
162
|
+
def has_positional?: () -> bool
|
160
163
|
|
161
|
-
def self.empty: () ->
|
164
|
+
def self.empty: () -> Params
|
162
165
|
|
163
|
-
def ==: (untyped other) ->
|
166
|
+
def ==: (untyped other) -> bool
|
164
167
|
|
165
168
|
alias eql? ==
|
166
169
|
|
167
|
-
def hash: () ->
|
170
|
+
def hash: () -> Integer
|
168
171
|
|
169
172
|
def flat_unnamed_params: () -> Array[[:required | :optional, AST::Types::t]]
|
170
173
|
|
171
|
-
def flat_keywords: () ->
|
174
|
+
def flat_keywords: () -> Hash[Symbol, AST::Types::t]
|
172
175
|
|
173
|
-
def required_keywords: () ->
|
176
|
+
def required_keywords: () -> Hash[Symbol, AST::Types::t]
|
174
177
|
|
175
|
-
def optional_keywords: () ->
|
178
|
+
def optional_keywords: () -> Hash[Symbol, AST::Types::t]
|
176
179
|
|
177
|
-
def rest_keywords: () ->
|
180
|
+
def rest_keywords: () -> AST::Types::t?
|
178
181
|
|
179
|
-
def has_keywords?: () ->
|
182
|
+
def has_keywords?: () -> bool
|
180
183
|
|
181
184
|
def each_positional_param: () { (PositionalParams::Base) -> void } -> void
|
182
185
|
|
183
|
-
def without_keywords: () ->
|
186
|
+
def without_keywords: () -> Params
|
184
187
|
|
185
|
-
def drop_first: () ->
|
188
|
+
def drop_first: () -> Params
|
186
189
|
|
187
190
|
def each_type: () { (AST::Types::t) -> void } -> void
|
188
191
|
| () -> Enumerator[AST::Types::t, void]
|
189
192
|
|
190
|
-
|
193
|
+
@fvs: Set[AST::Types::variable]?
|
194
|
+
def free_variables: () -> Set[AST::Types::variable]
|
191
195
|
|
192
|
-
def closed?: () ->
|
196
|
+
def closed?: () -> bool
|
193
197
|
|
194
198
|
def subst: (Substitution s) -> Params
|
195
199
|
|
196
|
-
def size: () ->
|
200
|
+
def size: () -> Integer
|
197
201
|
|
198
202
|
def to_s: () -> ::String
|
199
203
|
|
@@ -244,7 +248,8 @@ module Steep
|
|
244
248
|
|
245
249
|
def hash: () -> Integer
|
246
250
|
|
247
|
-
|
251
|
+
@fvs: Set[AST::Types::variable]?
|
252
|
+
def free_variables: () -> Set[AST::Types::variable]
|
248
253
|
|
249
254
|
def subst: (Substitution s) -> Function
|
250
255
|
|
@@ -2,11 +2,26 @@ module Steep
|
|
2
2
|
module Interface
|
3
3
|
class Shape
|
4
4
|
class Entry
|
5
|
-
|
5
|
+
@private_method: bool
|
6
6
|
|
7
|
-
|
7
|
+
@method_types: Array[MethodType]?
|
8
|
+
|
9
|
+
@generator: (^() -> Array[MethodType]?)?
|
10
|
+
|
11
|
+
def initialize: (method_types: Array[MethodType], private_method: bool) -> void
|
12
|
+
| (private_method: bool) { () -> Array[MethodType]? } -> void
|
13
|
+
|
14
|
+
def has_method_type?: () -> bool
|
8
15
|
|
9
16
|
def to_s: () -> String
|
17
|
+
|
18
|
+
def private_method?: () -> bool
|
19
|
+
|
20
|
+
def public_method?: () -> bool
|
21
|
+
|
22
|
+
def method_types: () -> Array[MethodType]
|
23
|
+
|
24
|
+
def force: () -> void
|
10
25
|
end
|
11
26
|
|
12
27
|
class Methods
|
@@ -36,9 +51,9 @@ module Steep
|
|
36
51
|
|
37
52
|
def push_substitution: (Substitution) -> Methods
|
38
53
|
|
39
|
-
def merge!: (Methods other) -> void
|
54
|
+
def merge!: (Methods other) ?{ (Symbol name, Entry old_entry, Entry new_entry) -> Entry } -> void
|
40
55
|
|
41
|
-
|
56
|
+
def public_methods: () -> Methods
|
42
57
|
end
|
43
58
|
|
44
59
|
attr_reader type: AST::Types::t
|
@@ -56,6 +71,10 @@ module Steep
|
|
56
71
|
def public?: () -> bool
|
57
72
|
|
58
73
|
def subst: (Substitution, ?type: AST::Types::t?) -> Shape
|
74
|
+
|
75
|
+
def public_shape: () -> Shape
|
76
|
+
|
77
|
+
@public_shape: Shape?
|
59
78
|
end
|
60
79
|
end
|
61
80
|
end
|
@@ -41,6 +41,8 @@ module Steep
|
|
41
41
|
|
42
42
|
def merge: (Substitution s) -> Substitution
|
43
43
|
|
44
|
+
def update: (?self_type: AST::Types::t?, ?instance_type: AST::Types::t?, ?module_type: AST::Types::t?) -> Substitution
|
45
|
+
|
44
46
|
def apply?: (AST::Types::t) -> bool
|
45
47
|
|
46
48
|
def add!: (Symbol v, AST::Types::t ty) -> self
|
data/sig/steep/node_helper.rbs
CHANGED
@@ -66,6 +66,17 @@ module Steep
|
|
66
66
|
|
67
67
|
def test_send_node: (Node) { (Node?, Symbol, Array[Node], send_loc) -> bool } -> bool
|
68
68
|
|
69
|
+
# Returns if given node allows calling private method
|
70
|
+
#
|
71
|
+
# The node must be:
|
72
|
+
#
|
73
|
+
# * A `send` node,
|
74
|
+
# * A `csend` node,
|
75
|
+
# * A `block` node, or
|
76
|
+
# * A `nblock` node
|
77
|
+
#
|
78
|
+
def private_send?: (Node) -> bool
|
79
|
+
|
69
80
|
# Deconstruct sendish node and it's associated block node
|
70
81
|
#
|
71
82
|
# Receives a sequence of node tree where the leaf node comes first.
|
@@ -91,8 +91,8 @@ module Steep
|
|
91
91
|
|
92
92
|
def lower_bound: (Symbol var, ?skip: bool) -> AST::Types::t
|
93
93
|
|
94
|
-
def solution: (Check checker, variables: Enumerable[
|
95
|
-
| (Check checker, variables: Enumerable[
|
94
|
+
def solution: (Check checker, variables: Enumerable[AST::Types::variable], variance: VariableVariance, self_type: AST::Types::t, instance_type: AST::Types::t, class_type: AST::Types::t) -> Interface::Substitution
|
95
|
+
| (Check checker, variables: Enumerable[AST::Types::variable], context: Context) -> Interface::Substitution
|
96
96
|
|
97
97
|
def has_constraint?: (Symbol var) -> bool
|
98
98
|
|
@@ -81,7 +81,7 @@ module Steep
|
|
81
81
|
class Failure < Base
|
82
82
|
type error = MethodMissingError | BlockMismatchError | ParameterMismatchError
|
83
83
|
| UnknownPairError | PolyMethodSubtyping | UnsatisfiedConstraints
|
84
|
-
| SelfBindingMismatch
|
84
|
+
| SelfBindingMismatch | LoopAbort
|
85
85
|
|
86
86
|
class MethodMissingError
|
87
87
|
attr_reader name: untyped
|
@@ -145,6 +145,10 @@ module Steep
|
|
145
145
|
def message: () -> String
|
146
146
|
end
|
147
147
|
|
148
|
+
class LoopAbort
|
149
|
+
def message: () -> String
|
150
|
+
end
|
151
|
+
|
148
152
|
attr_reader error: error
|
149
153
|
|
150
154
|
def initialize: (Relation[untyped] relation, error error) -> void
|
@@ -325,7 +325,7 @@ module Steep
|
|
325
325
|
def set_up_block_mlhs_params_env: (
|
326
326
|
Parser::AST::Node mlhs_node,
|
327
327
|
AST::Types::t type,
|
328
|
-
Hash[Symbol
|
328
|
+
Hash[Symbol?, AST::Types::t]
|
329
329
|
) { (Parser::AST::Node error_mlhs_node, AST::Types::t type) -> void } -> void
|
330
330
|
|
331
331
|
# Returns a Pair of
|
@@ -37,7 +37,7 @@ module Steep
|
|
37
37
|
# * `node` is the node of the parameter
|
38
38
|
#
|
39
39
|
class Param
|
40
|
-
attr_reader var: Symbol
|
40
|
+
attr_reader var: Symbol?
|
41
41
|
|
42
42
|
attr_reader type: AST::Types::t?
|
43
43
|
|
@@ -45,7 +45,7 @@ module Steep
|
|
45
45
|
|
46
46
|
attr_reader node: Parser::AST::Node
|
47
47
|
|
48
|
-
def initialize: (var: Symbol
|
48
|
+
def initialize: (var: Symbol?, type: AST::Types::t?, value: Parser::AST::Node?, node: Parser::AST::Node) -> void
|
49
49
|
|
50
50
|
def ==: (untyped other) -> bool
|
51
51
|
|
@@ -147,6 +147,8 @@ module Steep
|
|
147
147
|
# Returns the upper bound of a type variable
|
148
148
|
def []: (Symbol name) -> AST::Types::t?
|
149
149
|
|
150
|
+
@upper_bounds: Hash[Symbol, AST::Types::t]?
|
151
|
+
|
150
152
|
def upper_bounds: () -> Hash[Symbol, AST::Types::t]
|
151
153
|
|
152
154
|
def self.empty: () -> TypeVariableContext
|
data/sig/steep.rbs
CHANGED
@@ -14,7 +14,7 @@ module Steep
|
|
14
14
|
|
15
15
|
attr_accessor self.log_output: IO
|
16
16
|
|
17
|
-
def self.measure: [A] (String message, ?level: ::Symbol) { () -> A } -> A
|
17
|
+
def self.measure: [A] (String message, ?level: ::Symbol, ?threshold: Float) { () -> A } -> A
|
18
18
|
|
19
19
|
def self.log_error: (Exception exn, ?message: ::String) -> void
|
20
20
|
|
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.7.0.dev.
|
4
|
+
version: 1.7.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: 2024-
|
11
|
+
date: 2024-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -362,6 +362,7 @@ files:
|
|
362
362
|
- lib/steep/subtyping/relation.rb
|
363
363
|
- lib/steep/subtyping/result.rb
|
364
364
|
- lib/steep/subtyping/variable_variance.rb
|
365
|
+
- lib/steep/test.rb
|
365
366
|
- lib/steep/thread_waiter.rb
|
366
367
|
- lib/steep/type_construction.rb
|
367
368
|
- lib/steep/type_inference/block_params.rb
|
@@ -503,7 +504,6 @@ files:
|
|
503
504
|
- sig/steep/thread_waiter.rbs
|
504
505
|
- sig/steep/type_construction.rbs
|
505
506
|
- sig/steep/type_inference/block_params.rbs
|
506
|
-
- sig/steep/type_inference/branch.rbs
|
507
507
|
- sig/steep/type_inference/case_when.rbs
|
508
508
|
- sig/steep/type_inference/constant_env.rbs
|
509
509
|
- sig/steep/type_inference/context.rbs
|
@@ -1,15 +0,0 @@
|
|
1
|
-
use Steep::TypeConstruction::Pair, Steep::TypeInference::LogicTypeInterpreter::Result
|
2
|
-
|
3
|
-
module Steep
|
4
|
-
module TypeInference
|
5
|
-
class Branch
|
6
|
-
attr_reader start_env: TypeEnv
|
7
|
-
|
8
|
-
def initialize: (TypeEnv start_env) -> void
|
9
|
-
|
10
|
-
def add_branch: () { (TypeEnv) -> [Result, Pair] } -> void
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|