typeprof 0.15.2 → 0.15.3
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/Gemfile.lock +2 -2
- data/lib/typeprof/container-type.rb +7 -1
- data/lib/typeprof/import.rb +5 -0
- data/lib/typeprof/version.rb +1 -1
- data/smoke/array15.rb +1 -1
- data/smoke/array6.rb +2 -2
- data/smoke/array8.rb +1 -1
- data/smoke/block-args2.rb +3 -3
- data/smoke/block-args3.rb +4 -4
- data/smoke/hash-bot.rb +1 -1
- data/smoke/hash4.rb +1 -1
- data/smoke/parameterizedd-self.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13f530c84fe1b38000dc93982adac87c01d6d3a3516f8502e3de252d56428a12
|
4
|
+
data.tar.gz: b799ff212fd16b59bb96f8b560252e687d206e9a3ba541eaa6033532108957e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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
|
-
|
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 }]"
|
data/lib/typeprof/import.rb
CHANGED
@@ -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
|
data/lib/typeprof/version.rb
CHANGED
data/smoke/array15.rb
CHANGED
data/smoke/array6.rb
CHANGED
data/smoke/array8.rb
CHANGED
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[
|
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[
|
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[
|
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[
|
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[
|
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[
|
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[
|
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
data/smoke/hash4.rb
CHANGED
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.
|
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-
|
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.
|
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
|