typeprof 0.5.0 → 0.6.0
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 +3 -3
- data/lib/typeprof/analyzer.rb +145 -113
- data/lib/typeprof/builtin.rb +23 -8
- data/lib/typeprof/config.rb +10 -6
- data/lib/typeprof/container-type.rb +26 -17
- data/lib/typeprof/export.rb +6 -6
- data/lib/typeprof/import.rb +50 -26
- data/lib/typeprof/method.rb +32 -15
- data/lib/typeprof/type.rb +20 -14
- data/lib/typeprof/version.rb +1 -1
- data/smoke/array11.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/block-blockarg.rb +1 -1
- data/smoke/block5.rb +1 -1
- data/smoke/constant2.rb +1 -2
- data/smoke/demo5.rb +1 -1
- data/smoke/demo9.rb +1 -1
- data/smoke/hash-merge-bang.rb +1 -1
- data/smoke/hash1.rb +2 -1
- data/smoke/hash4.rb +1 -1
- data/smoke/inheritance2.rb +2 -2
- data/smoke/ivar2.rb +1 -1
- data/smoke/kernel-class.rb +1 -1
- data/smoke/kwsplat1.rb +1 -1
- data/smoke/multiple-superclass.rb +1 -1
- data/smoke/parameterizedd-self.rb +2 -2
- data/smoke/parameterizedd-self2.rb +15 -0
- data/smoke/rbs-tyvar6.rb +17 -0
- data/smoke/rbs-tyvar6.rbs +12 -0
- data/smoke/struct.rb +2 -2
- data/smoke/super4.rb +43 -0
- data/smoke/super5.rb +36 -0
- data/smoke/union-recv.rb +2 -2
- data/typeprof.gemspec +1 -1
- metadata +9 -4
data/lib/typeprof/version.rb
CHANGED
data/smoke/array11.rb
CHANGED
|
@@ -9,5 +9,5 @@ array("foo")
|
|
|
9
9
|
__END__
|
|
10
10
|
# Classes
|
|
11
11
|
class Object
|
|
12
|
-
def array : (Array[Integer] |
|
|
12
|
+
def array : (Array[Integer] | Hash[Integer, Integer] | String) -> (Array[Hash[Integer, Integer] | Integer | String])
|
|
13
13
|
end
|
data/smoke/array6.rb
CHANGED
data/smoke/array8.rb
CHANGED
data/smoke/block-args2.rb
CHANGED
|
@@ -47,11 +47,11 @@ __END__
|
|
|
47
47
|
# Classes
|
|
48
48
|
class Object
|
|
49
49
|
def f1 : { -> nil } -> ^(nil, *bot, nil) -> nil
|
|
50
|
-
def log1 : (nil, [], nil) -> nil
|
|
50
|
+
def log1 : (nil, Array[bot], nil) -> nil
|
|
51
51
|
def f2 : { (:a) -> nil } -> ^(:a, *bot, nil) -> nil
|
|
52
|
-
def log2 : (:a, [], nil) -> nil
|
|
52
|
+
def log2 : (:a, Array[bot], nil) -> nil
|
|
53
53
|
def f3 : { (:a, :b) -> nil } -> ^(:a, *bot, :b) -> nil
|
|
54
|
-
def log3 : (:a, [], :b) -> nil
|
|
54
|
+
def log3 : (:a, Array[bot], :b) -> nil
|
|
55
55
|
def f4 : { (:a, :b, :c) -> nil } -> ^(:a, *:b, :c) -> nil
|
|
56
56
|
def log4 : (:a, [:b], :c) -> nil
|
|
57
57
|
def f5 : { (:a, :b, :c, :d) -> nil } -> (^(:a, *:b | :c, :d) -> nil)
|
data/smoke/block-args3.rb
CHANGED
|
@@ -56,13 +56,13 @@ __END__
|
|
|
56
56
|
# Classes
|
|
57
57
|
class Object
|
|
58
58
|
def f1 : { -> nil } -> ^(nil, ?:opt, *bot, nil) -> nil
|
|
59
|
-
def log1 : (nil, :opt, [], nil) -> nil
|
|
59
|
+
def log1 : (nil, :opt, Array[bot], nil) -> nil
|
|
60
60
|
def f2 : { (:a) -> nil } -> ^(:a, ?:opt, *bot, nil) -> nil
|
|
61
|
-
def log2 : (:a, :opt, [], nil) -> nil
|
|
61
|
+
def log2 : (:a, :opt, Array[bot], nil) -> nil
|
|
62
62
|
def f3 : { (:a, :b) -> nil } -> ^(:a, ?:opt, *bot, :b) -> nil
|
|
63
|
-
def log3 : (:a, :opt, [], :b) -> nil
|
|
63
|
+
def log3 : (:a, :opt, Array[bot], :b) -> nil
|
|
64
64
|
def f4 : { (:a, :b, :c) -> nil } -> (^(:a, ?:b | :opt, *bot, :c) -> nil)
|
|
65
|
-
def log4 : (:a, :b | :opt, [], :c) -> nil
|
|
65
|
+
def log4 : (:a, :b | :opt, Array[bot], :c) -> nil
|
|
66
66
|
def f5 : { (:a, :b, :c, :d) -> nil } -> (^(:a, ?:b | :opt, *:c, :d) -> nil)
|
|
67
67
|
def log5 : (:a, :b | :opt, [:c], :d) -> nil
|
|
68
68
|
def f6 : { (:a, :b, :c, :d, :e) -> nil } -> (^(:a, ?:b | :opt, *:c | :d, :e) -> nil)
|
data/smoke/block-blockarg.rb
CHANGED
data/smoke/block5.rb
CHANGED
data/smoke/constant2.rb
CHANGED
|
@@ -24,12 +24,11 @@ smoke/constant2.rb:15: [warning] already initialized constant Object::BAR
|
|
|
24
24
|
|
|
25
25
|
# Classes
|
|
26
26
|
class Object
|
|
27
|
-
C : String
|
|
28
27
|
BAR : String
|
|
29
28
|
def foo : (Integer | untyped) -> nil
|
|
30
29
|
def log : (String) -> nil
|
|
31
30
|
end
|
|
32
31
|
|
|
33
|
-
class C
|
|
32
|
+
class C
|
|
34
33
|
def foo : -> nil
|
|
35
34
|
end
|
data/smoke/demo5.rb
CHANGED
data/smoke/demo9.rb
CHANGED
data/smoke/hash-merge-bang.rb
CHANGED
data/smoke/hash1.rb
CHANGED
|
@@ -5,6 +5,7 @@ end
|
|
|
5
5
|
foo
|
|
6
6
|
|
|
7
7
|
def bar
|
|
8
|
+
# This returns {Integer=>Integer | String, String=>String} but RBS cannot express it
|
|
8
9
|
{ 1 => 1, 2 => "str", "s" => "s" }
|
|
9
10
|
end
|
|
10
11
|
|
|
@@ -14,5 +15,5 @@ __END__
|
|
|
14
15
|
# Classes
|
|
15
16
|
class Object
|
|
16
17
|
def foo : -> {int: Integer, str: String}
|
|
17
|
-
def bar : -> (
|
|
18
|
+
def bar : -> (Hash[Integer | String, Integer | String])
|
|
18
19
|
end
|
data/smoke/hash4.rb
CHANGED
data/smoke/inheritance2.rb
CHANGED
|
@@ -21,11 +21,11 @@ end
|
|
|
21
21
|
__END__
|
|
22
22
|
# Classes
|
|
23
23
|
class SuperBase
|
|
24
|
-
def self.foo : -> (A
|
|
24
|
+
def self.foo : -> (singleton(A) | singleton(B))
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
class Base < SuperBase
|
|
28
|
-
def self.foo : -> (A
|
|
28
|
+
def self.foo : -> (singleton(A) | singleton(B))
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
class A < Base
|
data/smoke/ivar2.rb
CHANGED
data/smoke/kernel-class.rb
CHANGED
data/smoke/kwsplat1.rb
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class Object
|
|
2
|
+
def foo
|
|
3
|
+
# The receiver is considered as an empty array
|
|
4
|
+
self[0]
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# The elements are dropped when it is passed as a receiver (to avoid state explosion)
|
|
9
|
+
[0].foo
|
|
10
|
+
|
|
11
|
+
__END__
|
|
12
|
+
# Classes
|
|
13
|
+
class Object
|
|
14
|
+
def foo : -> nil
|
|
15
|
+
end
|
data/smoke/rbs-tyvar6.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
def log1(obj) end
|
|
2
|
+
def log2(obj) end
|
|
3
|
+
def log3(obj) end
|
|
4
|
+
|
|
5
|
+
obj = Bar.new("str")
|
|
6
|
+
|
|
7
|
+
log1(obj)
|
|
8
|
+
log2(obj.test_superclass)
|
|
9
|
+
log3(obj.test_module)
|
|
10
|
+
|
|
11
|
+
__END__
|
|
12
|
+
# Classes
|
|
13
|
+
class Object
|
|
14
|
+
def log1 : (Bar[String]) -> nil
|
|
15
|
+
def log2 : (Array[String]) -> nil
|
|
16
|
+
def log3 : (Integer) -> nil
|
|
17
|
+
end
|
data/smoke/struct.rb
CHANGED
data/smoke/super4.rb
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module M1
|
|
2
|
+
def f(m); super :M1; end
|
|
3
|
+
end
|
|
4
|
+
module M2
|
|
5
|
+
def f(m); super :M2; end
|
|
6
|
+
end
|
|
7
|
+
class C
|
|
8
|
+
def f(m); end
|
|
9
|
+
end
|
|
10
|
+
class D < C
|
|
11
|
+
def f(m); super :D; end
|
|
12
|
+
include M1
|
|
13
|
+
end
|
|
14
|
+
class E < D
|
|
15
|
+
def f(m); super :E; end
|
|
16
|
+
include M2
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
E.new.f(:top)
|
|
20
|
+
|
|
21
|
+
__END__
|
|
22
|
+
# Classes
|
|
23
|
+
module M1
|
|
24
|
+
def f : (:D) -> nil
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
module M2
|
|
28
|
+
def f : (:E) -> nil
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class C
|
|
32
|
+
def f : (:M1) -> nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class D < C
|
|
36
|
+
include M1
|
|
37
|
+
def f : (:M2) -> nil
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class E < D
|
|
41
|
+
include M2
|
|
42
|
+
def f : (:top) -> nil
|
|
43
|
+
end
|
data/smoke/super5.rb
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module M
|
|
2
|
+
def f(m); super :M; end
|
|
3
|
+
end
|
|
4
|
+
class C
|
|
5
|
+
def f(m); end
|
|
6
|
+
end
|
|
7
|
+
class D < C
|
|
8
|
+
def f(m); super :D; end
|
|
9
|
+
include M
|
|
10
|
+
end
|
|
11
|
+
class E < D
|
|
12
|
+
def f(m); super :E; end
|
|
13
|
+
include M
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
E.new.f(:top)
|
|
17
|
+
|
|
18
|
+
__END__
|
|
19
|
+
# Classes
|
|
20
|
+
module M
|
|
21
|
+
def f : (:D | :E) -> nil
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class C
|
|
25
|
+
def f : (:M) -> nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class D < C
|
|
29
|
+
include M
|
|
30
|
+
def f : (:M) -> nil
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class E < D
|
|
34
|
+
include M
|
|
35
|
+
def f : (:top) -> nil
|
|
36
|
+
end
|
data/smoke/union-recv.rb
CHANGED
|
@@ -21,11 +21,11 @@ end
|
|
|
21
21
|
__END__
|
|
22
22
|
# Classes
|
|
23
23
|
class SuperBase
|
|
24
|
-
def self.foo : -> (A
|
|
24
|
+
def self.foo : -> (singleton(A) | singleton(B))
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
class Base < SuperBase
|
|
28
|
-
def self.foo : -> (A
|
|
28
|
+
def self.foo : -> (singleton(A) | singleton(B))
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
class A < Base
|
data/typeprof.gemspec
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.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yusuke Endoh
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-11-
|
|
11
|
+
date: 2020-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rbs
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
19
|
+
version: 0.17.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
26
|
+
version: 0.17.0
|
|
27
27
|
description: |
|
|
28
28
|
TypeProf performs a type analysis of non-annotated Ruby code.
|
|
29
29
|
|
|
@@ -229,6 +229,7 @@ files:
|
|
|
229
229
|
- smoke/optional2.rb
|
|
230
230
|
- smoke/optional3.rb
|
|
231
231
|
- smoke/parameterizedd-self.rb
|
|
232
|
+
- smoke/parameterizedd-self2.rb
|
|
232
233
|
- smoke/pathname1.rb
|
|
233
234
|
- smoke/pathname2.rb
|
|
234
235
|
- smoke/pattern-match1.rb
|
|
@@ -264,6 +265,8 @@ files:
|
|
|
264
265
|
- smoke/rbs-tyvar4.rb
|
|
265
266
|
- smoke/rbs-tyvar5.rb
|
|
266
267
|
- smoke/rbs-tyvar5.rbs
|
|
268
|
+
- smoke/rbs-tyvar6.rb
|
|
269
|
+
- smoke/rbs-tyvar6.rbs
|
|
267
270
|
- smoke/rbs-vars.rb
|
|
268
271
|
- smoke/rbs-vars.rbs
|
|
269
272
|
- smoke/redo1.rb
|
|
@@ -292,6 +295,8 @@ files:
|
|
|
292
295
|
- smoke/super1.rb
|
|
293
296
|
- smoke/super2.rb
|
|
294
297
|
- smoke/super3.rb
|
|
298
|
+
- smoke/super4.rb
|
|
299
|
+
- smoke/super5.rb
|
|
295
300
|
- smoke/svar1.rb
|
|
296
301
|
- smoke/symbol-proc.rb
|
|
297
302
|
- smoke/tap1.rb
|