steep 0.22.0 → 0.28.0
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/CHANGELOG.md +46 -1
- data/bin/smoke_runner.rb +3 -4
- data/lib/steep.rb +1 -1
- data/lib/steep/ast/builtin.rb +2 -20
- data/lib/steep/ast/types.rb +5 -3
- data/lib/steep/ast/types/any.rb +1 -3
- data/lib/steep/ast/types/boolean.rb +1 -3
- data/lib/steep/ast/types/bot.rb +1 -3
- data/lib/steep/ast/types/class.rb +2 -2
- data/lib/steep/ast/types/factory.rb +106 -55
- data/lib/steep/ast/types/helper.rb +6 -0
- data/lib/steep/ast/types/instance.rb +2 -2
- data/lib/steep/ast/types/intersection.rb +20 -13
- data/lib/steep/ast/types/literal.rb +1 -3
- data/lib/steep/ast/types/name.rb +15 -67
- data/lib/steep/ast/types/nil.rb +1 -3
- data/lib/steep/ast/types/proc.rb +5 -2
- data/lib/steep/ast/types/record.rb +9 -4
- data/lib/steep/ast/types/self.rb +1 -1
- data/lib/steep/ast/types/top.rb +1 -3
- data/lib/steep/ast/types/tuple.rb +5 -3
- data/lib/steep/ast/types/union.rb +16 -9
- data/lib/steep/ast/types/var.rb +2 -2
- data/lib/steep/ast/types/void.rb +1 -3
- data/lib/steep/drivers/check.rb +4 -0
- data/lib/steep/errors.rb +14 -0
- data/lib/steep/interface/interface.rb +5 -62
- data/lib/steep/interface/method_type.rb +383 -92
- data/lib/steep/interface/substitution.rb +48 -6
- data/lib/steep/project/completion_provider.rb +1 -1
- data/lib/steep/project/hover_content.rb +1 -1
- data/lib/steep/project/target.rb +5 -2
- data/lib/steep/server/base_worker.rb +5 -3
- data/lib/steep/server/code_worker.rb +2 -0
- data/lib/steep/server/master.rb +10 -1
- data/lib/steep/source.rb +4 -3
- data/lib/steep/subtyping/check.rb +49 -60
- data/lib/steep/type_construction.rb +629 -366
- data/lib/steep/type_inference/block_params.rb +5 -0
- data/lib/steep/type_inference/constant_env.rb +1 -1
- data/lib/steep/type_inference/context.rb +8 -0
- data/lib/steep/type_inference/context_array.rb +4 -3
- data/lib/steep/type_inference/logic.rb +31 -0
- data/lib/steep/typing.rb +7 -0
- data/lib/steep/version.rb +1 -1
- data/smoke/alias/a.rb +1 -1
- data/smoke/case/a.rb +1 -1
- data/smoke/hash/d.rb +1 -1
- data/smoke/if/a.rb +1 -1
- data/smoke/module/a.rb +1 -1
- data/smoke/rescue/a.rb +4 -13
- data/steep.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e15a2388cd89e6b169243007211840853be8c126e035f7aa6434b00258e1087
|
4
|
+
data.tar.gz: e3bb8c7a1d816cb2667e7dc977f5e3155bcb9444e995a210bd58dc716a6a71b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb77f06dcef27e222984269a637966fa581cd78b3157c31a71793e8447f7059467140b7bb3f8f3e7f059a37492c9988f428234011ff7b3f7133a627f60a63cf4
|
7
|
+
data.tar.gz: 9319aebc6f74f89d055098312f460b2ed86ae9cfcd5c17bd21425c69e3ebe8838dffa3f4db9c99bc23bbc4657e4ee9f453bf1a2b3b7e4afe1531c0ba0ccb386c
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,51 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.28.0 (2020-09-17)
|
6
|
+
|
7
|
+
* Fix typing case-when with empty body ([#200](https://github.com/soutaro/steep/pull/200))
|
8
|
+
* Fix lvasgn typing with `void` type hint ([#200](https://github.com/soutaro/steep/pull/200))
|
9
|
+
* Fix subtype checking between type variables and union types ([#200](https://github.com/soutaro/steep/pull/200))
|
10
|
+
* Support endless range ([#200](https://github.com/soutaro/steep/pull/200))
|
11
|
+
* Fix optarg, kwoptarg typing ([#202](https://github.com/soutaro/steep/pull/202))
|
12
|
+
* Better union/intersection types ([#204](https://github.com/soutaro/steep/pull/204))
|
13
|
+
* Fix generic method instantiation ([#205](https://github.com/soutaro/steep/pull/205))
|
14
|
+
* Fix module typing ([#206](https://github.com/soutaro/steep/pull/206))
|
15
|
+
* Fix shutdown problem ([#209](https://github.com/soutaro/steep/pull/209))
|
16
|
+
* Update RBS to 0.12.0 ([#210](https://github.com/soutaro/steep/pull/210))
|
17
|
+
* Improve processing singleton class decls without RBS ([#211](https://github.com/soutaro/steep/pull/211))
|
18
|
+
* Improve processing block parameter with masgn ([#212](https://github.com/soutaro/steep/pull/212))
|
19
|
+
|
20
|
+
## 0.27.0 (2020-08-31)
|
21
|
+
|
22
|
+
* Make tuple types _covariant_ ([#195](https://github.com/soutaro/steep/pull/195))
|
23
|
+
* Support `or_asgn`/`and_asgn` with `send` node lhs ([#194](https://github.com/soutaro/steep/pull/194))
|
24
|
+
* Performance improvement ([#193](https://github.com/soutaro/steep/pull/193))
|
25
|
+
* Add specialized versions of `#first` and `#last` on tuples ([#191](https://github.com/soutaro/steep/pull/191))
|
26
|
+
* Typing bug fix on `[]` (empty array) ([#190](https://github.com/soutaro/steep/pull/190))
|
27
|
+
* Earlier shutdown with interruption while `steep watch` ([#173](https://github.com/soutaro/steep/pull/173))
|
28
|
+
|
29
|
+
## 0.26.0
|
30
|
+
|
31
|
+
* Skipped
|
32
|
+
|
33
|
+
## 0.25.0 (2020-08-18)
|
34
|
+
|
35
|
+
* Improve `op_send` typing ([#186](https://github.com/soutaro/steep/pull/186))
|
36
|
+
* Improve `op_asgn` typing ([#189](https://github.com/soutaro/steep/pull/189))
|
37
|
+
* Better multi-assignment support ([#183](https://github.com/soutaro/steep/pull/183), [#184](https://github.com/soutaro/steep/pull/184))
|
38
|
+
* Support for loop and class variables ([#182](https://github.com/soutaro/steep/pull/182))
|
39
|
+
* Fix tuple typing ([#181](https://github.com/soutaro/steep/pull/181))
|
40
|
+
|
41
|
+
## 0.24.0 (2020-08-11)
|
42
|
+
|
43
|
+
* Update RBS to 0.10 ([#180](https://github.com/soutaro/steep/pull/180))
|
44
|
+
|
45
|
+
## 0.23.0 (2020-08-06)
|
46
|
+
|
47
|
+
* Fix literal typing with hint ([#179](https://github.com/soutaro/steep/pull/179))
|
48
|
+
* Fix literal type subtyping ([#178](https://github.com/soutaro/steep/pull/178))
|
49
|
+
|
5
50
|
## 0.22.0 (2020-08-03)
|
6
51
|
|
7
52
|
* Improve signature validation ([#175](https://github.com/soutaro/steep/pull/175), [#177](https://github.com/soutaro/steep/pull/177))
|
@@ -51,7 +96,7 @@
|
|
51
96
|
|
52
97
|
* Fix constant resolution ([#143](https://github.com/soutaro/steep/pull/143))
|
53
98
|
* Fix RBS diagnostics line number in LSP ([#142](https://github.com/soutaro/steep/pull/142))
|
54
|
-
* Fix crash caused by hover on `def` in LSP ([#140](https://github.com/soutaro/steep/pull/140))
|
99
|
+
* Fix crash caused by hover on `def` in LSP ([#140](https://github.com/soutaro/steep/pull/140))
|
55
100
|
|
56
101
|
## 0.16.0 (2020-05-19)
|
57
102
|
|
data/bin/smoke_runner.rb
CHANGED
@@ -19,8 +19,6 @@ Expectation = Struct.new(:line, :message, :path, :starts) do
|
|
19
19
|
attr_accessor :prefix_test
|
20
20
|
end
|
21
21
|
|
22
|
-
allowed_paths = []
|
23
|
-
|
24
22
|
failed = false
|
25
23
|
|
26
24
|
ARGV.each do |arg|
|
@@ -29,12 +27,13 @@ ARGV.each do |arg|
|
|
29
27
|
|
30
28
|
rb_files = []
|
31
29
|
expectations = []
|
32
|
-
|
30
|
+
allowed_paths = []
|
31
|
+
|
33
32
|
dir.children.each do |file|
|
34
33
|
if file.extname == ".rb"
|
35
34
|
buffer = ::Parser::Source::Buffer.new(file.to_s)
|
36
35
|
buffer.source = file.read
|
37
|
-
parser = ::Parser::
|
36
|
+
parser = ::Parser::Ruby27.new
|
38
37
|
|
39
38
|
_, comments, _ = parser.tokenize(buffer)
|
40
39
|
comments.each do |comment|
|
data/lib/steep.rb
CHANGED
data/lib/steep/ast/builtin.rb
CHANGED
@@ -15,12 +15,8 @@ module Steep
|
|
15
15
|
Types::Name::Instance.new(name: module_name, args: args)
|
16
16
|
end
|
17
17
|
|
18
|
-
def class_type(constructor: nil)
|
19
|
-
Types::Name::Class.new(name: module_name, constructor: constructor)
|
20
|
-
end
|
21
|
-
|
22
18
|
def module_type
|
23
|
-
Types::Name::
|
19
|
+
Types::Name::Singleton.new(name: module_name)
|
24
20
|
end
|
25
21
|
|
26
22
|
def instance_type?(type, args: nil)
|
@@ -36,22 +32,8 @@ module Steep
|
|
36
32
|
end
|
37
33
|
end
|
38
34
|
|
39
|
-
NONE = ::Object.new
|
40
|
-
|
41
|
-
def class_type?(type, constructor: NONE)
|
42
|
-
if type.is_a?(Types::Name::Class)
|
43
|
-
unless constructor.equal?(NONE)
|
44
|
-
type.name == module_name && type.name.constructor == constructor
|
45
|
-
else
|
46
|
-
type.name == module_name
|
47
|
-
end
|
48
|
-
else
|
49
|
-
false
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
35
|
def module_type?(type)
|
54
|
-
if type.is_a?(Types::Name::
|
36
|
+
if type.is_a?(Types::Name::Singleton)
|
55
37
|
type.name == module_name
|
56
38
|
else
|
57
39
|
false
|
data/lib/steep/ast/types.rb
CHANGED
@@ -35,9 +35,11 @@ module Steep
|
|
35
35
|
"masked(#{type}|#{mask})"
|
36
36
|
end
|
37
37
|
|
38
|
-
def free_variables
|
39
|
-
|
40
|
-
|
38
|
+
def free_variables
|
39
|
+
@fvs ||= Set.new.tap do |set|
|
40
|
+
set.merge(type.free_variables)
|
41
|
+
set.merge(mask.free_variables)
|
42
|
+
end
|
41
43
|
end
|
42
44
|
|
43
45
|
def each_type(&block)
|
data/lib/steep/ast/types/any.rb
CHANGED
data/lib/steep/ast/types/bot.rb
CHANGED
@@ -4,8 +4,14 @@ module Steep
|
|
4
4
|
class Factory
|
5
5
|
attr_reader :definition_builder
|
6
6
|
|
7
|
+
attr_reader :type_name_cache
|
8
|
+
attr_reader :type_cache
|
9
|
+
|
7
10
|
def initialize(builder:)
|
8
11
|
@definition_builder = builder
|
12
|
+
|
13
|
+
@type_name_cache = {}
|
14
|
+
@type_cache = {}
|
9
15
|
end
|
10
16
|
|
11
17
|
def type_name_resolver
|
@@ -13,7 +19,9 @@ module Steep
|
|
13
19
|
end
|
14
20
|
|
15
21
|
def type(type)
|
16
|
-
|
22
|
+
ty = type_cache[type] and return ty
|
23
|
+
|
24
|
+
type_cache[type] = case type
|
17
25
|
when RBS::Types::Bases::Any
|
18
26
|
Any.new(location: nil)
|
19
27
|
when RBS::Types::Bases::Class
|
@@ -36,7 +44,7 @@ module Steep
|
|
36
44
|
Var.new(name: type.name, location: nil)
|
37
45
|
when RBS::Types::ClassSingleton
|
38
46
|
type_name = type_name(type.name)
|
39
|
-
Name::
|
47
|
+
Name::Singleton.new(name: type_name, location: nil)
|
40
48
|
when RBS::Types::ClassInstance
|
41
49
|
type_name = type_name(type.name)
|
42
50
|
args = type.args.map {|arg| type(arg) }
|
@@ -94,7 +102,7 @@ module Steep
|
|
94
102
|
RBS::Types::Bases::Nil.new(location: nil)
|
95
103
|
when Var
|
96
104
|
RBS::Types::Variable.new(name: type.name, location: nil)
|
97
|
-
when Name::
|
105
|
+
when Name::Singleton
|
98
106
|
RBS::Types::ClassSingleton.new(name: type_name_1(type.name), location: nil)
|
99
107
|
when Name::Instance
|
100
108
|
RBS::Types::ClassInstance.new(
|
@@ -144,14 +152,17 @@ module Steep
|
|
144
152
|
end
|
145
153
|
|
146
154
|
def type_name(name)
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
+
n = type_name_cache[name] and return n
|
156
|
+
|
157
|
+
type_name_cache[name] =
|
158
|
+
(case
|
159
|
+
when name.class?
|
160
|
+
Names::Module.new(name: name.name, namespace: namespace(name.namespace), location: nil)
|
161
|
+
when name.interface?
|
162
|
+
Names::Interface.new(name: name.name, namespace: namespace(name.namespace), location: nil)
|
163
|
+
when name.alias?
|
164
|
+
Names::Alias.new(name: name.name, namespace: namespace(name.namespace), location: nil)
|
165
|
+
end)
|
155
166
|
end
|
156
167
|
|
157
168
|
def type_name_1(name)
|
@@ -190,7 +201,7 @@ module Steep
|
|
190
201
|
)
|
191
202
|
end
|
192
203
|
|
193
|
-
def method_type(method_type, self_type:)
|
204
|
+
def method_type(method_type, self_type:, subst2: nil)
|
194
205
|
fvs = self_type.free_variables()
|
195
206
|
|
196
207
|
type_params = []
|
@@ -208,6 +219,7 @@ module Steep
|
|
208
219
|
end
|
209
220
|
end
|
210
221
|
subst = Interface::Substitution.build(alpha_vars, alpha_types)
|
222
|
+
subst.merge!(subst2, overwrite: true) if subst2
|
211
223
|
|
212
224
|
type = Interface::MethodType.new(
|
213
225
|
type_params: type_params,
|
@@ -288,7 +300,7 @@ module Steep
|
|
288
300
|
def expand_alias(type)
|
289
301
|
unfolded = case type
|
290
302
|
when AST::Types::Name::Alias
|
291
|
-
|
303
|
+
unfold(type.name)
|
292
304
|
else
|
293
305
|
type
|
294
306
|
end
|
@@ -301,6 +313,7 @@ module Steep
|
|
301
313
|
end
|
302
314
|
|
303
315
|
def interface(type, private:, self_type: type)
|
316
|
+
Steep.logger.debug { "Factory#interface: #{type}, private=#{private}, self_type=#{self_type}" }
|
304
317
|
type = expand_alias(type)
|
305
318
|
|
306
319
|
case type
|
@@ -328,14 +341,15 @@ module Steep
|
|
328
341
|
)
|
329
342
|
|
330
343
|
definition.methods.each do |name, method|
|
331
|
-
|
344
|
+
Steep.logger.tagged "method = #{name}" do
|
345
|
+
next if method.private? && !private
|
332
346
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
347
|
+
interface.methods[name] = Interface::Interface::Entry.new(
|
348
|
+
method_types: method.method_types.map do |type|
|
349
|
+
method_type(type, self_type: self_type, subst2: subst)
|
350
|
+
end
|
351
|
+
)
|
352
|
+
end
|
339
353
|
end
|
340
354
|
end
|
341
355
|
|
@@ -351,16 +365,15 @@ module Steep
|
|
351
365
|
)
|
352
366
|
|
353
367
|
definition.methods.each do |name, method|
|
354
|
-
interface.methods[name] = Interface::Interface::
|
355
|
-
method.method_types.map do |type|
|
356
|
-
method_type(type, self_type: self_type
|
357
|
-
end
|
358
|
-
incompatible: method.attributes.include?(:incompatible)
|
368
|
+
interface.methods[name] = Interface::Interface::Entry.new(
|
369
|
+
method_types: method.method_types.map do |type|
|
370
|
+
method_type(type, self_type: self_type, subst2: subst)
|
371
|
+
end
|
359
372
|
)
|
360
373
|
end
|
361
374
|
end
|
362
375
|
|
363
|
-
when Name::
|
376
|
+
when Name::Singleton
|
364
377
|
Interface::Interface.new(type: self_type, private: private).tap do |interface|
|
365
378
|
definition = definition_builder.build_singleton(type_name_1(type.name))
|
366
379
|
|
@@ -377,11 +390,10 @@ module Steep
|
|
377
390
|
definition.methods.each do |name, method|
|
378
391
|
next if !private && method.private?
|
379
392
|
|
380
|
-
interface.methods[name] = Interface::Interface::
|
381
|
-
method.method_types.map do |type|
|
382
|
-
method_type(type, self_type: self_type
|
383
|
-
end
|
384
|
-
incompatible: method.attributes.include?(:incompatible)
|
393
|
+
interface.methods[name] = Interface::Interface::Entry.new(
|
394
|
+
method_types: method.method_types.map do |type|
|
395
|
+
method_type(type, self_type: self_type, subst2: subst)
|
396
|
+
end
|
385
397
|
)
|
386
398
|
end
|
387
399
|
end
|
@@ -404,7 +416,25 @@ module Steep
|
|
404
416
|
Interface::Interface.new(type: self_type, private: private).tap do |interface|
|
405
417
|
common_methods = Set.new(interface1.methods.keys) & Set.new(interface2.methods.keys)
|
406
418
|
common_methods.each do |name|
|
407
|
-
|
419
|
+
types1 = interface1.methods[name].method_types
|
420
|
+
types2 = interface2.methods[name].method_types
|
421
|
+
|
422
|
+
if types1 == types2
|
423
|
+
interface.methods[name] = interface1.methods[name]
|
424
|
+
else
|
425
|
+
method_types = {}
|
426
|
+
|
427
|
+
types1.each do |type1|
|
428
|
+
types2.each do |type2|
|
429
|
+
type = type1 | type2 or next
|
430
|
+
method_types[type] = true
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
unless method_types.empty?
|
435
|
+
interface.methods[name] = Interface::Interface::Entry.new(method_types: method_types.keys)
|
436
|
+
end
|
437
|
+
end
|
408
438
|
end
|
409
439
|
end
|
410
440
|
end
|
@@ -415,11 +445,8 @@ module Steep
|
|
415
445
|
interfaces = type.types.map {|ty| interface(ty, private: private, self_type: self_type) }
|
416
446
|
interfaces.inject do |interface1, interface2|
|
417
447
|
Interface::Interface.new(type: self_type, private: private).tap do |interface|
|
418
|
-
|
419
|
-
|
420
|
-
methods = [interface1.methods[name], interface2.methods[name]].compact
|
421
|
-
interface.methods[name] = Interface::Interface::Combination.intersection(methods)
|
422
|
-
end
|
448
|
+
interface.methods.merge!(interface1.methods)
|
449
|
+
interface.methods.merge!(interface2.methods)
|
423
450
|
end
|
424
451
|
end
|
425
452
|
end
|
@@ -430,8 +457,8 @@ module Steep
|
|
430
457
|
array_type = Builtin::Array.instance_type(element_type)
|
431
458
|
interface(array_type, private: private, self_type: self_type).tap do |array_interface|
|
432
459
|
array_interface.methods[:[]] = array_interface.methods[:[]].yield_self do |aref|
|
433
|
-
Interface::Interface::
|
434
|
-
type.types.map.with_index {|elem_type, index|
|
460
|
+
Interface::Interface::Entry.new(
|
461
|
+
method_types: type.types.map.with_index {|elem_type, index|
|
435
462
|
Interface::MethodType.new(
|
436
463
|
type_params: [],
|
437
464
|
params: Interface::Params.new(required: [AST::Types::Literal.new(value: index)],
|
@@ -444,14 +471,13 @@ module Steep
|
|
444
471
|
return_type: elem_type,
|
445
472
|
location: nil
|
446
473
|
)
|
447
|
-
} + aref.
|
448
|
-
incompatible: false
|
474
|
+
} + aref.method_types
|
449
475
|
)
|
450
476
|
end
|
451
477
|
|
452
478
|
array_interface.methods[:[]=] = array_interface.methods[:[]=].yield_self do |update|
|
453
|
-
Interface::Interface::
|
454
|
-
type.types.map.with_index {|elem_type, index|
|
479
|
+
Interface::Interface::Entry.new(
|
480
|
+
method_types: type.types.map.with_index {|elem_type, index|
|
455
481
|
Interface::MethodType.new(
|
456
482
|
type_params: [],
|
457
483
|
params: Interface::Params.new(required: [AST::Types::Literal.new(value: index), elem_type],
|
@@ -464,8 +490,35 @@ module Steep
|
|
464
490
|
return_type: elem_type,
|
465
491
|
location: nil
|
466
492
|
)
|
467
|
-
} + update.
|
468
|
-
|
493
|
+
} + update.method_types
|
494
|
+
)
|
495
|
+
end
|
496
|
+
|
497
|
+
array_interface.methods[:first] = array_interface.methods[:first].yield_self do |first|
|
498
|
+
Interface::Interface::Entry.new(
|
499
|
+
method_types: [
|
500
|
+
Interface::MethodType.new(
|
501
|
+
type_params: [],
|
502
|
+
params: Interface::Params.empty,
|
503
|
+
block: nil,
|
504
|
+
return_type: type.types[0] || AST::Builtin.nil_type,
|
505
|
+
location: nil
|
506
|
+
)
|
507
|
+
]
|
508
|
+
)
|
509
|
+
end
|
510
|
+
|
511
|
+
array_interface.methods[:last] = array_interface.methods[:last].yield_self do |last|
|
512
|
+
Interface::Interface::Entry.new(
|
513
|
+
method_types: [
|
514
|
+
Interface::MethodType.new(
|
515
|
+
type_params: [],
|
516
|
+
params: Interface::Params.empty,
|
517
|
+
block: nil,
|
518
|
+
return_type: type.types.last || AST::Builtin.nil_type,
|
519
|
+
location: nil
|
520
|
+
)
|
521
|
+
]
|
469
522
|
)
|
470
523
|
end
|
471
524
|
end
|
@@ -481,8 +534,8 @@ module Steep
|
|
481
534
|
|
482
535
|
interface(hash_type, private: private, self_type: self_type).tap do |hash_interface|
|
483
536
|
hash_interface.methods[:[]] = hash_interface.methods[:[]].yield_self do |ref|
|
484
|
-
Interface::Interface::
|
485
|
-
type.elements.map {|key_value, value_type|
|
537
|
+
Interface::Interface::Entry.new(
|
538
|
+
method_types: type.elements.map {|key_value, value_type|
|
486
539
|
key_type = Literal.new(value: key_value, location: nil)
|
487
540
|
Interface::MethodType.new(
|
488
541
|
type_params: [],
|
@@ -496,14 +549,13 @@ module Steep
|
|
496
549
|
return_type: value_type,
|
497
550
|
location: nil
|
498
551
|
)
|
499
|
-
} + ref.
|
500
|
-
incompatible: false
|
552
|
+
} + ref.method_types
|
501
553
|
)
|
502
554
|
end
|
503
555
|
|
504
556
|
hash_interface.methods[:[]=] = hash_interface.methods[:[]=].yield_self do |update|
|
505
|
-
Interface::Interface::
|
506
|
-
type.elements.map {|key_value, value_type|
|
557
|
+
Interface::Interface::Entry.new(
|
558
|
+
method_types: type.elements.map {|key_value, value_type|
|
507
559
|
key_type = Literal.new(value: key_value, location: nil)
|
508
560
|
Interface::MethodType.new(
|
509
561
|
type_params: [],
|
@@ -517,8 +569,7 @@ module Steep
|
|
517
569
|
return_type: value_type,
|
518
570
|
location: nil
|
519
571
|
)
|
520
|
-
} + update.
|
521
|
-
incompatible: false
|
572
|
+
} + update.method_types
|
522
573
|
)
|
523
574
|
end
|
524
575
|
end
|
@@ -534,8 +585,8 @@ module Steep
|
|
534
585
|
location: nil
|
535
586
|
)
|
536
587
|
|
537
|
-
interface.methods[:[]] = Interface::Interface::
|
538
|
-
interface.methods[:call] = Interface::Interface::
|
588
|
+
interface.methods[:[]] = Interface::Interface::Entry.new(method_types: [method_type])
|
589
|
+
interface.methods[:call] = Interface::Interface::Entry.new(method_types: [method_type])
|
539
590
|
end
|
540
591
|
|
541
592
|
else
|