typeprof 0.15.2 → 0.15.3

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: c31fc03c67fa15924e901b70890318e2391fa58cfaf897e51ff6a00d673d792a
4
- data.tar.gz: c6ce703ec1c5f8a41d04603162746adb8a9416ccf29abc8ef1441cf83a3b41e3
3
+ metadata.gz: 13f530c84fe1b38000dc93982adac87c01d6d3a3516f8502e3de252d56428a12
4
+ data.tar.gz: b799ff212fd16b59bb96f8b560252e687d206e9a3ba541eaa6033532108957e3
5
5
  SHA512:
6
- metadata.gz: 790815f2528442ae742df0c3576a97ff6d2c856db374f2c8a63bb965dd6c715b6fa686d84b1fd56683e938e9c8e4014e9e86b53bb34ca4e9975b93bb5e5188df
7
- data.tar.gz: ecc1433a74aebbe31c267c4697d71389a841cd66d74b251d1cc2d22bbeca228f141a8861ecbeebee3b16d54a8397f41eeab4f1f25ebac42103aee5e1146c9fe6
6
+ metadata.gz: 6e11866f36a7570ba564bf2abe6912f2531f728e76c4afc32f9bfddc436ea03a86a996eb4d3ddd2bf8c24e9eeae0986b45f17f06575d80df21b812585976f1ba
7
+ data.tar.gz: 8e990ceee15c1dba1cf529990fbb6e26a4f48946088549f51471c48ff1aeccfdc7cb8b6547c1105e00767263acee681db4340240f94c786b39bbeff842d501dc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- typeprof (0.15.1)
4
+ typeprof (0.15.3)
5
5
  rbs (>= 1.3.1)
6
6
 
7
7
  GEM
@@ -11,7 +11,7 @@ GEM
11
11
  docile (1.4.0)
12
12
  power_assert (2.0.0)
13
13
  rake (13.0.1)
14
- rbs (1.3.3)
14
+ rbs (1.6.1)
15
15
  simplecov (0.21.2)
16
16
  docile (~> 1.1)
17
17
  simplecov-html (~> 0.11)
@@ -307,7 +307,11 @@ module TypeProf
307
307
  def screen_name(scratch)
308
308
  if @rest_ty == Type.bot
309
309
  if @lead_tys.empty?
310
- return "Array[bot]" # RBS does not allow an empty tuple "[]"
310
+ # This is heuristic: in general, an empty array is a wrong guess.
311
+ # Note that an empty array is representable as "[ ]" in RBS, but
312
+ # users often have to modify it to "Array[something]".
313
+ # In this term, "Array[untyped]" is considered more useful than "[ ]".
314
+ return "Array[untyped]"
311
315
  end
312
316
  s = @lead_tys.map do |ty|
313
317
  ty.screen_name(scratch)
@@ -673,6 +677,8 @@ module TypeProf
673
677
  k_ty = k_ty.union(k)
674
678
  v_ty = v_ty.union(v)
675
679
  end
680
+ k_ty = Type.any if k_ty == Type.bot
681
+ v_ty = Type.any if v_ty == Type.bot
676
682
  k_ty = k_ty.screen_name(scratch)
677
683
  v_ty = v_ty.screen_name(scratch)
678
684
  "Hash[#{ k_ty }, #{ v_ty }]"
@@ -459,6 +459,8 @@ module TypeProf
459
459
  end
460
460
  when RBS::Types::Union
461
461
  [:union, ty.types.map {|ty2| conv_type(ty2) }.compact]
462
+ when RBS::Types::Intersection
463
+ [:intersection, ty.types.map {|ty2| conv_type(ty2) }.compact]
462
464
  when RBS::Types::Optional
463
465
  [:optional, conv_type(ty.type)]
464
466
  when RBS::Types::Interface
@@ -729,6 +731,9 @@ module TypeProf
729
731
  when :union
730
732
  tys = ty[1]
731
733
  Type::Union.create(Utils::Set[*tys.map {|ty2| conv_type(ty2) }], nil) # XXX: Array and Hash support
734
+ when :intersection
735
+ tys = ty[1]
736
+ conv_type(tys.first) # XXX: This is wrong! We need to support intersection type
732
737
  when :var
733
738
  Type::Var.new(ty[1])
734
739
  when :proc
@@ -1,3 +1,3 @@
1
1
  module TypeProf
2
- VERSION = "0.15.2"
2
+ VERSION = "0.15.3"
3
3
  end
data/smoke/array15.rb CHANGED
@@ -12,5 +12,5 @@ Foo.new[1] = "str"
12
12
  __END__
13
13
  # Classes
14
14
  class Foo
15
- def []=: (*Integer | String args) -> Array[bot]
15
+ def []=: (*Integer | String args) -> Array[untyped]
16
16
  end
data/smoke/array6.rb CHANGED
@@ -10,8 +10,8 @@ foo(1, "str")
10
10
  __END__
11
11
  # Classes
12
12
  class Object
13
- ARY: Array[bot]
13
+ ARY: Array[untyped]
14
14
 
15
15
  private
16
- def foo: (Integer i, String v) -> Array[bot]
16
+ def foo: (Integer i, String v) -> Array[untyped]
17
17
  end
data/smoke/array8.rb CHANGED
@@ -9,5 +9,5 @@ end
9
9
  __END__
10
10
  # Classes
11
11
  class Foo
12
- def self.foo: (Array[bot] a) -> Array[bot]
12
+ def self.foo: (Array[untyped] a) -> Array[untyped]
13
13
  end
data/smoke/block-args2.rb CHANGED
@@ -48,11 +48,11 @@ __END__
48
48
  class Object
49
49
  private
50
50
  def f1: { -> nil } -> ^(nil, *bot, nil) -> nil
51
- def log1: (nil a, Array[bot] r, nil c) -> nil
51
+ def log1: (nil a, Array[untyped] r, nil c) -> nil
52
52
  def f2: { (:a) -> nil } -> ^(:a, *bot, nil) -> nil
53
- def log2: (:a a, Array[bot] r, nil c) -> nil
53
+ def log2: (:a a, Array[untyped] r, nil c) -> nil
54
54
  def f3: { (:a, :b) -> nil } -> ^(:a, *bot, :b) -> nil
55
- def log3: (:a a, Array[bot] r, :b c) -> nil
55
+ def log3: (:a a, Array[untyped] r, :b c) -> nil
56
56
  def f4: { (:a, :b, :c) -> nil } -> ^(:a, *:b, :c) -> nil
57
57
  def log4: (:a a, [:b] r, :c c) -> nil
58
58
  def f5: { (:a, :b, :c, :d) -> nil } -> (^(:a, *:b | :c, :d) -> nil)
data/smoke/block-args3.rb CHANGED
@@ -57,13 +57,13 @@ __END__
57
57
  class Object
58
58
  private
59
59
  def f1: { -> nil } -> ^(nil, ?:opt, *bot, nil) -> nil
60
- def log1: (nil a, :opt o, Array[bot] r, nil c) -> nil
60
+ def log1: (nil a, :opt o, Array[untyped] r, nil c) -> nil
61
61
  def f2: { (:a) -> nil } -> ^(:a, ?:opt, *bot, nil) -> nil
62
- def log2: (:a a, :opt o, Array[bot] r, nil c) -> nil
62
+ def log2: (:a a, :opt o, Array[untyped] r, nil c) -> nil
63
63
  def f3: { (:a, :b) -> nil } -> ^(:a, ?:opt, *bot, :b) -> nil
64
- def log3: (:a a, :opt o, Array[bot] r, :b c) -> nil
64
+ def log3: (:a a, :opt o, Array[untyped] r, :b c) -> nil
65
65
  def f4: { (:a, :b, :c) -> nil } -> (^(:a, ?:b | :opt, *bot, :c) -> nil)
66
- def log4: (:a a, :b | :opt o, Array[bot] r, :c c) -> nil
66
+ def log4: (:a a, :b | :opt o, Array[untyped] r, :c c) -> nil
67
67
  def f5: { (:a, :b, :c, :d) -> nil } -> (^(:a, ?:b | :opt, *:c, :d) -> nil)
68
68
  def log5: (:a a, :b | :opt o, [:c] r, :d c) -> nil
69
69
  def f6: { (:a, :b, :c, :d, :e) -> nil } -> (^(:a, ?:b | :opt, *:c | :d, :e) -> nil)
data/smoke/hash-bot.rb CHANGED
@@ -8,5 +8,5 @@ __END__
8
8
  # Classes
9
9
  class Object
10
10
  private
11
- def foo: -> Hash[Integer, Array[bot]]
11
+ def foo: -> Hash[Integer, Array[untyped]]
12
12
  end
data/smoke/hash4.rb CHANGED
@@ -7,5 +7,5 @@ __END__
7
7
  # Classes
8
8
  class Object
9
9
  private
10
- def foo: -> Hash[bot, bot]
10
+ def foo: -> Hash[untyped, untyped]
11
11
  end
@@ -13,8 +13,8 @@ bar([])
13
13
  __END__
14
14
  # Classes
15
15
  class Object
16
- def foo: -> Array[bot]
16
+ def foo: -> Array[untyped]
17
17
 
18
18
  private
19
- def bar: (Array[bot] ary) -> Array[bot]
19
+ def bar: (Array[untyped] ary) -> Array[untyped]
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typeprof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.2
4
+ version: 0.15.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Endoh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-18 00:00:00.000000000 Z
11
+ date: 2021-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs
@@ -419,7 +419,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
419
419
  - !ruby/object:Gem::Version
420
420
  version: '0'
421
421
  requirements: []
422
- rubygems_version: 3.3.0.dev
422
+ rubygems_version: 3.2.15
423
423
  signing_key:
424
424
  specification_version: 4
425
425
  summary: TypeProf is a type analysis tool for Ruby code based on abstract interpretation