steep 1.7.0.dev.2 → 1.7.0.dev.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -12
- data/gemfile_steep/Gemfile.lock +8 -10
- 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 +6 -9
- data/lib/steep/subtyping/check.rb +4 -16
- data/lib/steep/test.rb +9 -0
- data/lib/steep/type_construction.rb +13 -9
- 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/constraints.rbs +2 -2
- 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 -2
@@ -57,8 +57,9 @@ module Steep
|
|
57
57
|
|
58
58
|
def variable_types
|
59
59
|
each_param.with_object({}) do |param, hash|
|
60
|
+
var_name = param.var || next
|
60
61
|
# @type var hash: Hash[Symbol, AST::Types::t?]
|
61
|
-
hash[
|
62
|
+
hash[var_name] = param.type
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
@@ -133,10 +134,17 @@ module Steep
|
|
133
134
|
else
|
134
135
|
var = arg.children[0]
|
135
136
|
type = annotations.var_type(lvar: var)
|
136
|
-
|
137
137
|
case arg.type
|
138
|
-
when :arg
|
138
|
+
when :arg
|
139
139
|
default_params << Param.new(var: var, type: type, value: nil, node: arg)
|
140
|
+
when :procarg0
|
141
|
+
var = arg.children[0]
|
142
|
+
if var.is_a?(Symbol)
|
143
|
+
default_params << Param.new(var: var, type: type, value: nil, node: arg)
|
144
|
+
else
|
145
|
+
var = var.children[0]
|
146
|
+
default_params << Param.new(var: var, type: type, value: nil, node: arg)
|
147
|
+
end
|
140
148
|
when :optarg
|
141
149
|
default_params = trailing_params
|
142
150
|
optional_params << Param.new(var: var, type: type, value: arg.children.last, node: arg)
|
@@ -125,7 +125,7 @@ module Steep
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def upper_bounds
|
128
|
-
table.each_value.with_object({}) do |type_param, bounds|
|
128
|
+
@upper_bounds ||= table.each_value.with_object({}) do |type_param, bounds|
|
129
129
|
if type_param.upper_bound
|
130
130
|
bounds[type_param.name] = type_param.upper_bound
|
131
131
|
end
|
@@ -593,7 +593,7 @@ module Steep
|
|
593
593
|
end
|
594
594
|
|
595
595
|
def try_convert(type, method)
|
596
|
-
if shape = subtyping.builder.shape(type,
|
596
|
+
if shape = subtyping.builder.shape(type, config)
|
597
597
|
if entry = shape.methods[method]
|
598
598
|
method_type = entry.method_types.find do |method_type|
|
599
599
|
method_type.type.params.optional?
|
data/lib/steep/version.rb
CHANGED
data/lib/steep.rb
CHANGED
@@ -186,15 +186,19 @@ module Steep
|
|
186
186
|
@ui_logger = nil
|
187
187
|
self.log_output = STDERR
|
188
188
|
|
189
|
-
def self.measure(message, level: :warn)
|
189
|
+
def self.measure(message, level: :warn, threshold: 0.0)
|
190
190
|
start = Time.now
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
level
|
191
|
+
begin
|
192
|
+
yield
|
193
|
+
ensure
|
194
|
+
time = Time.now - start
|
195
|
+
if level.is_a?(Symbol)
|
196
|
+
level = Logger.const_get(level.to_s.upcase)
|
197
|
+
end
|
198
|
+
if time > threshold
|
199
|
+
self.logger.log(level) { "#{message} took #{time} seconds" }
|
200
|
+
end
|
196
201
|
end
|
197
|
-
self.logger.log(level) { "#{message} took #{time} seconds" }
|
198
202
|
end
|
199
203
|
|
200
204
|
def self.log_error(exn, message: "Unexpected error: #{exn.inspect}")
|
@@ -51,6 +51,7 @@ module Steep
|
|
51
51
|
def map_type: () { (t) -> t } -> self
|
52
52
|
end
|
53
53
|
|
54
|
+
# Singleton of a class/module
|
54
55
|
class Singleton < Base
|
55
56
|
def ==: (untyped other) -> bool
|
56
57
|
|
@@ -65,13 +66,16 @@ module Steep
|
|
65
66
|
include Helper::NoChild
|
66
67
|
end
|
67
68
|
|
69
|
+
# An instance of a class/module
|
68
70
|
class Instance < Applying
|
69
71
|
def to_module: () -> Singleton
|
70
72
|
end
|
71
73
|
|
74
|
+
# An interface type
|
72
75
|
class Interface < Applying
|
73
76
|
end
|
74
77
|
|
78
|
+
# Type alias
|
75
79
|
class Alias < Applying
|
76
80
|
end
|
77
81
|
end
|
data/sig/steep/expectations.rbs
CHANGED
@@ -19,7 +19,7 @@ module Steep
|
|
19
19
|
|
20
20
|
def initialize: (start_position: position, end_position: position, severity: Steep::Diagnostic::LSPFormatter::severity, message: String, code: String) -> void
|
21
21
|
|
22
|
-
def self.from_hash: (untyped) ->
|
22
|
+
def self.from_hash: (untyped) -> Diagnostic
|
23
23
|
|
24
24
|
def self.from_lsp: (untyped) -> Diagnostic
|
25
25
|
|
@@ -6,161 +6,147 @@ module Steep
|
|
6
6
|
class Config
|
7
7
|
# Type of `self` type included immediately in the type expression
|
8
8
|
#
|
9
|
-
attr_reader self_type: AST::Types::t
|
9
|
+
attr_reader self_type: AST::Types::t?
|
10
10
|
|
11
11
|
# Type of `class` type included immediately in the type expression
|
12
12
|
#
|
13
|
-
attr_reader class_type: AST::Types::t
|
13
|
+
attr_reader class_type: AST::Types::t?
|
14
14
|
|
15
15
|
# Type of `instance` type included immediately in the type expression
|
16
16
|
#
|
17
|
-
attr_reader instance_type: AST::Types::t
|
17
|
+
attr_reader instance_type: AST::Types::t?
|
18
18
|
|
19
|
-
#
|
20
|
-
|
21
|
-
# * `false` only when the type expression is `self`
|
22
|
-
#
|
23
|
-
attr_reader resolve_self: bool
|
19
|
+
# Upper bounds of type variables
|
20
|
+
attr_reader variable_bounds: Hash[Symbol, AST::Types::t?]
|
24
21
|
|
25
|
-
|
26
|
-
|
27
|
-
# * `false` only when the type expression is `class`
|
28
|
-
#
|
29
|
-
attr_reader resolve_class: bool
|
22
|
+
def initialize: (self_type: AST::Types::t?, variable_bounds: Hash[Symbol, AST::Types::t?]) -> void
|
23
|
+
| (self_type: AST::Types::t?, class_type: AST::Types::t, instance_type: AST::Types::t, variable_bounds: Hash[Symbol, AST::Types::t?]) -> void
|
30
24
|
|
31
|
-
|
32
|
-
#
|
33
|
-
# * `false` only when the type expression is `instance`
|
34
|
-
#
|
35
|
-
attr_reader resolve_instance: bool
|
25
|
+
def subst: () -> Substitution?
|
36
26
|
|
37
|
-
|
27
|
+
def self.empty: () -> Config
|
38
28
|
|
39
|
-
def
|
40
|
-
self_type: AST::Types::t,
|
41
|
-
class_type: AST::Types::t | nil,
|
42
|
-
instance_type: AST::Types::t | nil,
|
43
|
-
?resolve_self: bool,
|
44
|
-
?resolve_class: bool,
|
45
|
-
?resolve_instance: bool,
|
46
|
-
variable_bounds: Hash[Symbol, AST::Types::t?]
|
47
|
-
) -> void
|
29
|
+
def upper_bound: (Symbol) -> AST::Types::t?
|
48
30
|
|
49
|
-
|
50
|
-
?self_type: AST::Types::t,
|
51
|
-
?class_type: AST::Types::t | nil,
|
52
|
-
?instance_type: AST::Types::t | nil,
|
53
|
-
?resolve_self: bool,
|
54
|
-
?resolve_class: bool,
|
55
|
-
?resolve_instance: bool,
|
56
|
-
?variable_bounds: Hash[Symbol, AST::Types::t?]
|
57
|
-
) -> self
|
31
|
+
private
|
58
32
|
|
59
|
-
|
60
|
-
def no_resolve: () -> self
|
33
|
+
def validate: () -> self
|
61
34
|
|
62
|
-
def
|
35
|
+
def validate_fvs: (Symbol name, AST::Types::t?) -> void
|
36
|
+
end
|
63
37
|
|
64
|
-
|
38
|
+
attr_reader factory: AST::Types::Factory
|
65
39
|
|
66
|
-
|
40
|
+
# # No type application (if generic), no self-instance-module resolution
|
41
|
+
attr_reader object_shape_cache: Hash[TypeName, Shape?]
|
67
42
|
|
68
|
-
|
43
|
+
attr_reader union_shape_cache: Hash[AST::Types::Union, Shape?]
|
69
44
|
|
70
|
-
|
45
|
+
attr_reader singleton_shape_cache: Hash[TypeName, Shape?]
|
71
46
|
|
72
|
-
|
73
|
-
def subst: () -> Substitution
|
47
|
+
def initialize: (AST::Types::Factory) -> void
|
74
48
|
|
75
|
-
|
76
|
-
#
|
77
|
-
def self_type?: () -> AST::Types::t?
|
49
|
+
def fetch_cache: [KEY] (Hash[KEY, Shape?], KEY) { () -> Shape? } -> Shape?
|
78
50
|
|
79
|
-
|
80
|
-
|
81
|
-
|
51
|
+
# Returns a shape of given type with respect to Config
|
52
|
+
#
|
53
|
+
# * If `self` occurs in the given type, it returns types with `self`
|
54
|
+
# * If `self` doesn't occur in the given type, it returns type withohut `self`, that is resolved to `config.self_type`
|
55
|
+
#
|
56
|
+
def shape: (AST::Types::t, Config) -> Shape?
|
82
57
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
58
|
+
# Returns a shape of given type with respect to Config
|
59
|
+
#
|
60
|
+
# The `self` types included in the returned Shape is the `self` type in the top level
|
61
|
+
#
|
62
|
+
# * `raw_shape(<self>)` -> may return a shape with `self`
|
63
|
+
# * `raw_shape(<Array[self]>) -> returns a shape that returns `self` from `#first` method
|
64
|
+
#
|
65
|
+
def raw_shape: (AST::Types::t, Config) -> Shape?
|
87
66
|
|
88
|
-
|
67
|
+
def self_shape: (AST::Types::t, Config) -> Shape?
|
89
68
|
|
90
|
-
|
91
|
-
AST::Types::t, # type
|
92
|
-
bool, # public_only
|
93
|
-
AST::Types::t | nil, # self_type
|
94
|
-
AST::Types::t | nil, # class_type
|
95
|
-
AST::Types::t | nil, # instance_type
|
96
|
-
bool, bool, bool, # resolve_self, resolve_class, resolve_instance
|
97
|
-
Hash[Symbol, AST::Types::t?]? # variable_bounds
|
98
|
-
]
|
99
|
-
attr_reader cache: Hash[cache_key, Shape?]
|
69
|
+
private
|
100
70
|
|
101
|
-
|
102
|
-
attr_reader raw_instance_object_shape_cache: Hash[[TypeName, bool], Shape]
|
71
|
+
def object_shape: (RBS::TypeName) -> Shape
|
103
72
|
|
104
|
-
|
73
|
+
def singleton_shape: (RBS::TypeName) -> Shape
|
105
74
|
|
106
|
-
|
75
|
+
def union_shape: (AST::Types::t, Array[Shape]) -> Shape?
|
107
76
|
|
108
|
-
def
|
77
|
+
def intersection_shape: (AST::Types::t, Array[Shape]) -> Shape?
|
109
78
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
79
|
+
def proc_shape: (AST::Types::Proc, Shape) -> Shape
|
80
|
+
|
81
|
+
def tuple_shape: (AST::Types::Tuple) { (AST::Types::Name::Instance) -> Shape? } -> Shape?
|
82
|
+
|
83
|
+
def record_shape: (AST::Types::Record) { (AST::Types::Name::Instance) -> Shape? } -> Shape?
|
84
|
+
|
85
|
+
# Substitution for `self`/`instance`/`class` types, built from the name of given type
|
115
86
|
#
|
116
|
-
def
|
87
|
+
def class_subst: (AST::Types::Name::Instance | AST::Types::Name::Singleton) -> Substitution
|
117
88
|
|
118
|
-
|
89
|
+
def interface_subst: (AST::Types::Name::Interface) -> Substitution
|
90
|
+
|
91
|
+
# Substitution for type application of class instance, type alias, or interface types
|
92
|
+
def app_subst: (AST::Types::Name::Instance | AST::Types::Name::Alias | AST::Types::Name::Interface) -> Substitution
|
93
|
+
|
94
|
+
def method_name_for: (RBS::Definition::Method::TypeDef, Symbol name) -> method_name
|
95
|
+
|
96
|
+
def replace_primitive_method: (method_name, RBS::Definition::Method::TypeDef, MethodType) -> MethodType
|
97
|
+
|
98
|
+
# # Calculates the shape of given class, based on `public_only` and Config
|
99
|
+
# #
|
100
|
+
# # Returns `nil` if a type that cannot calculate Shape is given.
|
101
|
+
# #
|
102
|
+
# # * `public_only`: If false, returns a shape with private methods.
|
103
|
+
# #
|
104
|
+
# def shape: (AST::Types::t, public_only: bool, config: Config) -> Shape?
|
105
|
+
|
106
|
+
# private
|
119
107
|
|
120
108
|
@subtyping: Subtyping::Check?
|
121
109
|
|
122
110
|
def subtyping: () -> Subtyping::Check
|
123
111
|
|
124
|
-
# Fetch and update cache
|
125
|
-
#
|
126
|
-
# Cache if given type is cacheable:
|
127
|
-
#
|
128
|
-
# * `self`, `instance`, `class` is not cacheable
|
129
|
-
# * Type variables are not cacheable
|
130
|
-
#
|
131
|
-
def fetch_cache: (AST::Types::t, bool public_only, Config) { () -> Shape? } -> Shape?
|
112
|
+
# # Fetch and update cache
|
113
|
+
# #
|
114
|
+
# # Cache if given type is cacheable:
|
115
|
+
# #
|
116
|
+
# # * `self`, `instance`, `class` is not cacheable
|
117
|
+
# # * Type variables are not cacheable
|
118
|
+
# #
|
119
|
+
# def fetch_cache: (AST::Types::t, bool public_only, Config) { () -> Shape? } -> Shape?
|
132
120
|
|
133
|
-
def include_self?: (AST::Types::t) -> bool
|
121
|
+
# def include_self?: (AST::Types::t) -> bool
|
134
122
|
|
135
|
-
def definition_builder: () -> RBS::DefinitionBuilder
|
123
|
+
# def definition_builder: () -> RBS::DefinitionBuilder
|
136
124
|
|
137
|
-
def object_shape: (
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
) -> Shape
|
125
|
+
# def object_shape: (
|
126
|
+
# AST::Types::Name::Instance | AST::Types::Name::Singleton | AST::Types::Name::Interface,
|
127
|
+
# bool public_only,
|
128
|
+
# boolish keep_self,
|
129
|
+
# boolish keep_instance,
|
130
|
+
# boolish keep_singleton
|
131
|
+
# ) -> Shape
|
144
132
|
|
145
|
-
def raw_object_shape: (
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
) -> Shape
|
133
|
+
# def raw_object_shape: (
|
134
|
+
# AST::Types::Name::Instance | AST::Types::Name::Singleton | AST::Types::Name::Interface,
|
135
|
+
# bool public_only,
|
136
|
+
# Substitution subst
|
137
|
+
# ) -> Shape
|
150
138
|
|
151
|
-
def union_shape: (AST::Types::t, Array[Shape], bool public_only) -> Shape
|
139
|
+
# def union_shape: (AST::Types::t, Array[Shape], bool public_only) -> Shape
|
152
140
|
|
153
|
-
def intersection_shape: (AST::Types::t, Array[Shape], bool public_only) -> Shape
|
141
|
+
# def intersection_shape: (AST::Types::t, Array[Shape], bool public_only) -> Shape
|
154
142
|
|
155
|
-
def tuple_shape: (AST::Types::Tuple, bool public_only, Config) -> Shape
|
143
|
+
# def tuple_shape: (AST::Types::Tuple, bool public_only, Config) -> Shape
|
156
144
|
|
157
|
-
def record_shape: (AST::Types::Record, bool public_only, Config) -> Shape?
|
145
|
+
# def record_shape: (AST::Types::Record, bool public_only, Config) -> Shape?
|
158
146
|
|
159
|
-
def proc_shape: (AST::Types::Proc, bool public_only, Config) -> Shape?
|
147
|
+
# def proc_shape: (AST::Types::Proc, bool public_only, Config) -> Shape?
|
160
148
|
|
161
|
-
def replace_primitive_method: (method_name, RBS::Definition::Method::TypeDef, MethodType) -> MethodType
|
162
149
|
|
163
|
-
def method_name_for: (RBS::Definition::Method::TypeDef, Symbol name) -> method_name
|
164
150
|
end
|
165
151
|
end
|
166
152
|
end
|
@@ -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
|