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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81293a79329d8902860bab9ed6d82d7dd3cb3b07d81dc65c99c0b02acc0b8704
4
- data.tar.gz: d77dd60c0237a8474e0719f22fa94976e2bab32126d7f7c5576a7edd7ca88d99
3
+ metadata.gz: b701d322a3c49aa1444c839bee4a2da7265776463f8963780431251ab3c96903
4
+ data.tar.gz: '069769e987f34a131983c2c3de966bb0f0591478bf4fa1dd79c3831213bed411'
5
5
  SHA512:
6
- metadata.gz: 0f5cbb876c8474a412e56f2ea2f2b5a23ac081c899d5ebc4a4a2914c9a93cddf28e90bb7485af05ea93214b3b87cdb2adefe14b9aa4223b073b059c0c13874ba
7
- data.tar.gz: c27548ab0e425974b1258b29c50c51a76586df6b4a9e05dca543aa94d94b70bad675f3f58890438d667b28a17d487c26191db0463e29803fb0ebb179b8d65835
6
+ metadata.gz: f264922829daa436adcf0e0e18bca9cc22397928fed215005785b2e8e3142e51afdd04b4f3b819b89565d1fb4c19cab2d17087445b8f3b313299810d24554646
7
+ data.tar.gz: f2b6c543d8f0742b6a971a3040431162c4333e2c0db969b5de7f5e495e86c1a19378fe8b8438255ec1cc4f413a6b21dbe07a7e1acc40d7b3c71e212309093a70
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.8.2 (2018-11-09)
6
+
7
+ * Fix ElseOnExhaustiveCase error implementation
8
+ * Add some builtin methods
9
+
5
10
  ## 0.8.1 (2018-10-29)
6
11
 
7
12
  * Remove duplicated detected paths (#67)
@@ -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
- def to_s
474
- "#{location_to_str}: ElseOnExhaustiveCase: type=#{type}"
475
- end
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
 
@@ -37,7 +37,7 @@ module Steep
37
37
  def each
38
38
  if block_given?
39
39
  array.each do |pair|
40
- yield *pair
40
+ yield(*pair)
41
41
  end
42
42
  else
43
43
  enum_for :each
@@ -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 *type.free_variables.to_a
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 *leading_params
43
- params.push *optional_params
42
+ params.push(*leading_params)
43
+ params.push(*optional_params)
44
44
  params.push rest_param if rest_param
45
- params.push *trailing_params
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 &block
232
+ params.each(&block)
233
233
  else
234
234
  enum_for :each
235
235
  end
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
@@ -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)
@@ -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.1
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-10-29 00:00:00.000000000 Z
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