typeprof 0.21.9 → 0.21.11

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: 4f679437d629955ec31b3467826bd4114be2b02786bd31b15736681e52d8d01a
4
- data.tar.gz: 8bd7c6403e4c7254e2de29a6d7515bd134996967266a138e2b11ca0834d604c3
3
+ metadata.gz: 2fe080a0c812f2be50d024eb51bd7c4ba751c2a720aaa99489e4a6271edba1e2
4
+ data.tar.gz: 6bd7b34c3428855355ff644ecf9987cda4db8645ba3a495a0f412f25c98a9972
5
5
  SHA512:
6
- metadata.gz: 2ea5197a66f4672a7804b6994d9613b09c55c000024aa78231a29cf6f531e398e507dc50b3fa0ac51f99ca1c64a6b259eee853421209fcc1034748d06f64c6b0
7
- data.tar.gz: a334eafef1cb1a808066f2e11862d6af634d38f5360b100699e30d19551213fd8d2b5763f4fd31c3a32273441e1753f15fbb956b7f00856745f678f024f93f70
6
+ metadata.gz: ac0242124986985239123f8a15e2cea01c77815cf2a9e5e586178fdece251d0e13172429ea09773d7b5136aed568db4e7e25fadcabb5a7afd000f57454c28b79
7
+ data.tar.gz: 4b36374f2af922eab5803e77666046896392153475d3dc892cc689e25beb84c83a6b5a164c344768b2d0951ba790832785907d1cf65b1f37cc91d9f1472cf957
data/Gemfile.lock CHANGED
@@ -1,17 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- typeprof (0.21.8)
4
+ typeprof (0.21.11)
5
5
  rbs (>= 1.8.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
+ abbrev (0.1.2)
10
11
  coverage-helpers (1.0.0)
11
12
  docile (1.4.0)
12
13
  power_assert (2.0.1)
13
14
  rake (13.0.1)
14
- rbs (3.2.0)
15
+ rbs (3.4.4)
16
+ abbrev
15
17
  simplecov (0.21.2)
16
18
  docile (~> 1.1)
17
19
  simplecov-html (~> 0.11)
@@ -2137,7 +2137,7 @@ module TypeProf
2137
2137
  end
2138
2138
  end
2139
2139
  return
2140
- when :concatarray
2140
+ when :concatarray, :concattoarray
2141
2141
  env, (ary1, ary2) = env.pop(2)
2142
2142
  if ary1.is_a?(Type::Local) && ary1.kind == Type::Array
2143
2143
  elems1 = get_container_elem_types(env, ep, ary1.id)
@@ -2156,6 +2156,20 @@ module TypeProf
2156
2156
  env, ty = localize_type(ty, env, ep)
2157
2157
  env = env.push(ty)
2158
2158
  end
2159
+ when :pushtoarray
2160
+ num, = operands
2161
+ env, (ary, ty, *tys) = env.pop(num + 1)
2162
+ if ary.is_a?(Type::Local) && ary.kind == Type::Array
2163
+ tys.each {|ty0| ty = ty.union(ty0) }
2164
+ elems = get_container_elem_types(env, ep, ary.id)
2165
+ elems = Type::Array::Elements.new([], elems.squash.union(ty))
2166
+ env = update_container_elem_types(env, ep, ary.id, ary.base_type) { elems }
2167
+ env = env.push(ary)
2168
+ else
2169
+ elems = Type::Array::Elements.new([], Type.any)
2170
+ env = update_container_elem_types(env, ep, ary.id, ary.base_type) { elems }
2171
+ env = env.push(ary)
2172
+ end
2159
2173
 
2160
2174
  when :checktype
2161
2175
  kind, = operands
@@ -32,6 +32,8 @@ TypeProf::INSN_TABLE = {:nop=>[],
32
32
  :duphash=>["VALUE"],
33
33
  :expandarray=>["rb_num_t", "rb_num_t"],
34
34
  :concatarray=>[],
35
+ :concattoarray=>[],
36
+ :pushtoarray=>["rb_num_t"],
35
37
  :splatarray=>["VALUE"],
36
38
  :newhash=>["rb_num_t"],
37
39
  :newrange=>["rb_num_t"],
data/lib/typeprof/iseq.rb CHANGED
@@ -276,7 +276,7 @@ module TypeProf
276
276
  misc[:def_node_id] = node_id
277
277
  end
278
278
  end
279
- ninsns << Insn.new(insn, operands, lineno, code_range, nil)
279
+ ninsns << i = Insn.new(insn, operands, lineno, code_range, nil)
280
280
  else
281
281
  raise "unknown iseq entry: #{ e }"
282
282
  end
@@ -840,10 +840,15 @@ module TypeProf
840
840
  sp -= 1
841
841
  return nil if sp <= 0
842
842
  sp += num + (splat ? 1 : 0)
843
- when :concatarray
843
+ when :concatarray, :concattoarray
844
844
  sp -= 2
845
845
  return nil if sp <= 0
846
846
  sp += 1
847
+ when :pushtoarray
848
+ num, = operands
849
+ sp -= num + 1
850
+ return nil if sp <= 0
851
+ sp += 1
847
852
  when :checktype
848
853
  sp -= 1
849
854
  return nil if sp <= 0
data/lib/typeprof/type.rb CHANGED
@@ -921,7 +921,7 @@ module TypeProf
921
921
 
922
922
  # Dirty Hack: Stop the iteration at most once!
923
923
  # I'll remove this hack if RBS removes the limitation of nesting blocks
924
- return fargs_str, sig_help if caller_locations.any? {|frame| frame.label == "show_block_signature" }
924
+ return fargs_str, sig_help if caller_locations.any? {|frame| frame.label =~ /\bshow_block_signature\z/ }
925
925
 
926
926
  optional = false
927
927
  blks = []
@@ -1,3 +1,3 @@
1
1
  module TypeProf
2
- VERSION = "0.21.9"
2
+ VERSION = "0.21.11"
3
3
  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.21.9
4
+ version: 0.21.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Endoh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-21 00:00:00.000000000 Z
11
+ date: 2024-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  requirements: []
92
- rubygems_version: 3.5.1
92
+ rubygems_version: 3.6.0.dev
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: TypeProf is a type analysis tool for Ruby code based on abstract interpretation