steep 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/steep/errors.rb +8 -3
- data/lib/steep/subtyping/trace.rb +1 -1
- data/lib/steep/type_construction.rb +2 -2
- data/lib/steep/type_inference/block_params.rb +4 -4
- data/lib/steep/version.rb +1 -1
- data/smoke/integer/a.rb +31 -0
- data/stdlib/builtin.rbi +20 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b701d322a3c49aa1444c839bee4a2da7265776463f8963780431251ab3c96903
|
4
|
+
data.tar.gz: '069769e987f34a131983c2c3de966bb0f0591478bf4fa1dd79c3831213bed411'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f264922829daa436adcf0e0e18bca9cc22397928fed215005785b2e8e3142e51afdd04b4f3b819b89565d1fb4c19cab2d17087445b8f3b313299810d24554646
|
7
|
+
data.tar.gz: f2b6c543d8f0742b6a971a3040431162c4333e2c0db969b5de7f5e495e86c1a19378fe8b8438255ec1cc4f413a6b21dbe07a7e1acc40d7b3c71e212309093a70
|
data/CHANGELOG.md
CHANGED
data/lib/steep/errors.rb
CHANGED
@@ -469,10 +469,15 @@ module Steep
|
|
469
469
|
end
|
470
470
|
|
471
471
|
class ElseOnExhaustiveCase < Base
|
472
|
+
attr_reader :type
|
473
|
+
|
472
474
|
def initialize(node:, type:)
|
473
|
-
|
474
|
-
|
475
|
-
|
475
|
+
super(node: node)
|
476
|
+
@type = type
|
477
|
+
end
|
478
|
+
|
479
|
+
def to_s
|
480
|
+
"#{location_to_str}: ElseOnExhaustiveCase: type=#{type}"
|
476
481
|
end
|
477
482
|
end
|
478
483
|
|
@@ -165,14 +165,14 @@ module Steep
|
|
165
165
|
annotation_types = annotation_method.types.each.with_object([]) do |method_type, array|
|
166
166
|
fresh = method_type.type_params.map {|var| AST::Types::Var.fresh(var) }
|
167
167
|
unknowns.push(*fresh)
|
168
|
-
|
168
|
+
|
169
169
|
subst = Interface::Substitution.build(method_type.type_params, fresh)
|
170
170
|
array << method_type.instantiate(subst)
|
171
171
|
end
|
172
172
|
|
173
173
|
constraints = Subtyping::Constraints.new(unknowns: unknowns)
|
174
174
|
interface_types.each do |type|
|
175
|
-
constraints.add_var
|
175
|
+
constraints.add_var(*type.free_variables.to_a)
|
176
176
|
end
|
177
177
|
|
178
178
|
result = checker.check_method(method_name,
|
@@ -39,10 +39,10 @@ module Steep
|
|
39
39
|
|
40
40
|
def params
|
41
41
|
[].tap do |params|
|
42
|
-
params.push
|
43
|
-
params.push
|
42
|
+
params.push(*leading_params)
|
43
|
+
params.push(*optional_params)
|
44
44
|
params.push rest_param if rest_param
|
45
|
-
params.push
|
45
|
+
params.push(*trailing_params)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -229,7 +229,7 @@ module Steep
|
|
229
229
|
|
230
230
|
def each(&block)
|
231
231
|
if block_given?
|
232
|
-
params.each
|
232
|
+
params.each(&block)
|
233
233
|
else
|
234
234
|
enum_for :each
|
235
235
|
end
|
data/lib/steep/version.rb
CHANGED
data/smoke/integer/a.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
integer_1 = Integer(1)
|
2
|
+
# !expects NoMethodError: type=::Integer, method=foo
|
3
|
+
integer_1.foo
|
4
|
+
|
5
|
+
integer_2 = Integer("1")
|
6
|
+
# !expects NoMethodError: type=::Integer, method=foo
|
7
|
+
integer_2.foo
|
8
|
+
|
9
|
+
class WithToInt
|
10
|
+
def to_int; 1; end
|
11
|
+
end
|
12
|
+
integer_3 = Integer(WithToInt.new)
|
13
|
+
# !expects NoMethodError: type=::Integer, method=foo
|
14
|
+
integer_3.foo
|
15
|
+
|
16
|
+
class WithToI
|
17
|
+
def to_i; 1; end
|
18
|
+
end
|
19
|
+
integer_4 = Integer(WithToI.new)
|
20
|
+
# !expects NoMethodError: type=::Integer, method=foo
|
21
|
+
integer_4.foo
|
22
|
+
|
23
|
+
integer_5 = Integer("10", 2)
|
24
|
+
# !expects NoMethodError: type=::Integer, method=foo
|
25
|
+
integer_5.foo
|
26
|
+
|
27
|
+
# !expects IncompatibleArguments: receiver=::Object, method_type=(::String, ::Integer) -> ::Integer
|
28
|
+
Integer(Object.new)
|
29
|
+
|
30
|
+
# !expects IncompatibleArguments: receiver=::Object, method_type=(::String, ::Integer) -> ::Integer
|
31
|
+
Integer(nil)
|
data/stdlib/builtin.rbi
CHANGED
@@ -12,7 +12,6 @@ class Object < BasicObject
|
|
12
12
|
def ===: (any) -> bool
|
13
13
|
def !=: (any) -> bool
|
14
14
|
def class: -> class
|
15
|
-
def to_i: -> Integer
|
16
15
|
def is_a?: (Module) -> bool
|
17
16
|
def inspect: -> String
|
18
17
|
def freeze: -> self
|
@@ -64,6 +63,8 @@ module Kernel
|
|
64
63
|
def loop: { () -> void } -> void
|
65
64
|
def puts: (*any) -> void
|
66
65
|
def eval: (String, ? Integer?, ?String) -> any
|
66
|
+
def Integer: (String, Integer) -> Integer
|
67
|
+
| (_ToI | _ToInt) -> Integer
|
67
68
|
end
|
68
69
|
|
69
70
|
class Array<'a>
|
@@ -251,6 +252,14 @@ interface _ToS
|
|
251
252
|
def to_s: -> String
|
252
253
|
end
|
253
254
|
|
255
|
+
interface _ToI
|
256
|
+
def to_i: -> Integer
|
257
|
+
end
|
258
|
+
|
259
|
+
interface _ToInt
|
260
|
+
def to_int: -> Integer
|
261
|
+
end
|
262
|
+
|
254
263
|
class TrueClass
|
255
264
|
def !: -> bool
|
256
265
|
end
|
@@ -273,6 +282,7 @@ class Numeric
|
|
273
282
|
end
|
274
283
|
|
275
284
|
class Integer < Numeric
|
285
|
+
def to_i: -> Integer
|
276
286
|
def to_int: -> Integer
|
277
287
|
def +: (Integer) -> Integer
|
278
288
|
| (Numeric) -> Numeric
|
@@ -367,6 +377,7 @@ class String
|
|
367
377
|
def sub: (Regexp | String, String) -> self
|
368
378
|
| (Regexp | String) { (String) -> _ToS } -> String
|
369
379
|
def chomp: -> String
|
380
|
+
| (String) -> String
|
370
381
|
def *: (Integer) -> String
|
371
382
|
def scan: (Regexp) { (Array<String>) -> void } -> String
|
372
383
|
| (Regexp) -> Array<String>
|
@@ -377,6 +388,9 @@ class String
|
|
377
388
|
def empty?: -> bool
|
378
389
|
def length: -> Integer
|
379
390
|
def force_encoding: (any) -> self
|
391
|
+
def to_i: -> Integer
|
392
|
+
| (Integer) -> Integer
|
393
|
+
def end_with?: (*String) -> bool
|
380
394
|
end
|
381
395
|
|
382
396
|
interface _Iteratable<'a, 'b>
|
@@ -665,6 +679,11 @@ STDOUT: IO
|
|
665
679
|
class StringIO
|
666
680
|
def initialize: (?String, ?String) -> any
|
667
681
|
def puts: (*any) -> void
|
682
|
+
def readline: () -> String
|
683
|
+
| (String) -> String
|
684
|
+
def write: (String) -> void
|
685
|
+
def flush: () -> void
|
686
|
+
def string: -> String
|
668
687
|
end
|
669
688
|
|
670
689
|
class Process::Status
|
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: 0.8.
|
4
|
+
version: 0.8.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: 2018-
|
11
|
+
date: 2018-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -273,6 +273,7 @@ files:
|
|
273
273
|
- smoke/implements/a.rbi
|
274
274
|
- smoke/initialize/a.rb
|
275
275
|
- smoke/initialize/a.rbi
|
276
|
+
- smoke/integer/a.rb
|
276
277
|
- smoke/interface/a.rb
|
277
278
|
- smoke/interface/a.rbi
|
278
279
|
- smoke/kwbegin/a.rb
|