typeprof 0.9.2 → 0.14.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/.github/workflows/main.yml +1 -1
- data/Gemfile.lock +6 -5
- data/doc/demo.md +2 -2
- data/doc/todo.md +133 -0
- data/lib/typeprof/analyzer.rb +201 -104
- data/lib/typeprof/block.rb +39 -4
- data/lib/typeprof/builtin.rb +217 -70
- data/lib/typeprof/cli.rb +7 -0
- data/lib/typeprof/config.rb +30 -14
- data/lib/typeprof/container-type.rb +24 -0
- data/lib/typeprof/export.rb +134 -74
- data/lib/typeprof/import.rb +87 -39
- data/lib/typeprof/iseq.rb +116 -41
- data/lib/typeprof/method.rb +29 -7
- data/lib/typeprof/type.rb +75 -13
- data/lib/typeprof/version.rb +1 -1
- data/smoke/alias.rb +4 -4
- data/smoke/alias2.rb +3 -1
- data/smoke/arguments.rb +2 -2
- data/smoke/arguments2.rb +5 -5
- data/smoke/array-each.rb +1 -1
- data/smoke/array-each3.rb +1 -1
- data/smoke/array-map.rb +1 -1
- data/smoke/array-map2.rb +1 -1
- data/smoke/array-map3.rb +3 -3
- data/smoke/array-mul.rb +2 -2
- data/smoke/array-plus1.rb +1 -1
- data/smoke/array-plus2.rb +1 -0
- data/smoke/array-range-aref.rb +11 -11
- data/smoke/array-replace.rb +1 -1
- data/smoke/array1.rb +5 -5
- data/smoke/array10.rb +1 -1
- data/smoke/array11.rb +1 -1
- data/smoke/array12.rb +1 -1
- data/smoke/array14.rb +1 -1
- data/smoke/array15.rb +1 -1
- data/smoke/array2.rb +2 -2
- data/smoke/array3.rb +1 -0
- data/smoke/array6.rb +2 -1
- data/smoke/array8.rb +1 -1
- data/smoke/array9.rb +1 -1
- data/smoke/attr-module.rb +1 -0
- data/smoke/attr-vis.rb +43 -0
- data/smoke/attr-vis.rbs +4 -0
- data/smoke/attr.rb +2 -2
- data/smoke/block-ambiguous.rb +4 -4
- data/smoke/block-args1-rest.rb +6 -5
- data/smoke/block-args1.rb +5 -5
- data/smoke/block-args2-rest.rb +6 -5
- data/smoke/block-args2.rb +5 -5
- data/smoke/block-args3-rest.rb +7 -6
- data/smoke/block-args3.rb +6 -6
- data/smoke/block-blockarg.rb +3 -3
- data/smoke/block-kwarg.rb +4 -4
- data/smoke/block1.rb +1 -1
- data/smoke/block10.rb +1 -1
- data/smoke/block11.rb +2 -2
- data/smoke/block2.rb +1 -1
- data/smoke/block3.rb +1 -1
- data/smoke/block5.rb +1 -0
- data/smoke/block_given.rb +37 -0
- data/smoke/break4.rb +17 -0
- data/smoke/class_eval.rb +22 -0
- data/smoke/class_method.rb +2 -2
- data/smoke/class_method2.rb +2 -2
- data/smoke/constant2.rb +3 -2
- data/smoke/context-sensitive1.rb +1 -1
- data/smoke/cvar.rb +3 -2
- data/smoke/define_method.rb +2 -2
- data/smoke/define_method3.rb +1 -0
- data/smoke/define_method4.rb +1 -1
- data/smoke/define_method6.rb +19 -0
- data/smoke/define_method7.rb +18 -0
- data/smoke/demo.rb +6 -6
- data/smoke/demo1.rb +1 -1
- data/smoke/demo11.rb +1 -1
- data/smoke/demo2.rb +1 -1
- data/smoke/demo3.rb +1 -1
- data/smoke/demo4.rb +3 -3
- data/smoke/demo5.rb +1 -1
- data/smoke/demo6.rb +2 -1
- data/smoke/demo7.rb +1 -1
- data/smoke/demo9.rb +1 -0
- data/smoke/dummy-execution1.rb +1 -1
- data/smoke/dummy-execution2.rb +1 -1
- data/smoke/dummy_element.rb +1 -1
- data/smoke/ensure1.rb +1 -1
- data/smoke/enum_for.rb +15 -0
- data/smoke/enum_for2.rb +17 -0
- data/smoke/extended.rb +38 -0
- data/smoke/fib.rb +2 -2
- data/smoke/flow1.rb +1 -1
- data/smoke/flow10.rb +17 -0
- data/smoke/flow11.rb +17 -0
- data/smoke/flow2.rb +1 -1
- data/smoke/flow3.rb +1 -1
- data/smoke/flow5.rb +1 -1
- data/smoke/flow6.rb +1 -1
- data/smoke/flow7.rb +1 -1
- data/smoke/flow8.rb +1 -1
- data/smoke/flow9.rb +1 -1
- data/smoke/function.rb +1 -1
- data/smoke/gvar.rb +1 -1
- data/smoke/gvar2.rb +1 -1
- data/smoke/hash-fetch.rb +3 -3
- data/smoke/included.rb +38 -0
- data/smoke/inheritance.rb +4 -4
- data/smoke/inherited.rb +26 -0
- data/smoke/initialize.rb +3 -2
- data/smoke/instance_eval.rb +2 -2
- data/smoke/instance_eval4.rb +12 -0
- data/smoke/int_times.rb +1 -1
- data/smoke/integer.rb +1 -1
- data/smoke/ivar.rb +3 -2
- data/smoke/ivar2.rb +2 -2
- data/smoke/ivar3.rb +2 -1
- data/smoke/ivar4.rb +1 -0
- data/smoke/kernel-class.rb +1 -1
- data/smoke/keyword4.rb +1 -1
- data/smoke/kwrest.rb +1 -0
- data/smoke/kwsplat1.rb +2 -2
- data/smoke/kwsplat2.rb +1 -1
- data/smoke/manual-rbs.rb +1 -0
- data/smoke/manual-rbs3.rb +1 -0
- data/smoke/method_missing.rb +4 -3
- data/smoke/module3.rb +1 -1
- data/smoke/module4.rb +1 -0
- data/smoke/module5.rb +1 -1
- data/smoke/module_function1.rb +3 -2
- data/smoke/module_function2.rb +3 -2
- data/smoke/multiple-include.rb +1 -0
- data/smoke/next1.rb +1 -1
- data/smoke/object-send1.rb +3 -3
- data/smoke/optional1.rb +1 -1
- data/smoke/optional2.rb +1 -1
- data/smoke/optional3.rb +1 -1
- data/smoke/parameterizedd-self.rb +2 -1
- data/smoke/prepend1.rb +33 -0
- data/smoke/prepend2.rb +10 -0
- data/smoke/prepend2.rbs +9 -0
- data/smoke/primitive_method.rb +19 -0
- data/smoke/proc4.rb +1 -1
- data/smoke/public.rb +4 -0
- data/smoke/range.rb +1 -1
- data/smoke/rbs-attr.rb +2 -2
- data/smoke/rbs-proc2.rb +1 -1
- data/smoke/rbs-proc3.rb +1 -1
- data/smoke/rbs-tyvar4.rb +3 -2
- data/smoke/rbs-tyvar6.rb +3 -3
- data/smoke/redo1.rb +1 -1
- data/smoke/redo2.rb +1 -1
- data/smoke/rescue1.rb +1 -1
- data/smoke/rescue2.rb +1 -1
- data/smoke/rescue3.rb +1 -0
- data/smoke/rescue4.rb +1 -1
- data/smoke/respond_to.rb +1 -1
- data/smoke/rest1.rb +2 -2
- data/smoke/rest2.rb +1 -1
- data/smoke/rest3.rb +6 -6
- data/smoke/rest4.rb +2 -2
- data/smoke/rest5.rb +1 -1
- data/smoke/rest6.rb +1 -1
- data/smoke/retry1.rb +2 -2
- data/smoke/simple.rb +1 -1
- data/smoke/step.rb +3 -3
- data/smoke/struct-keyword_init.rb +6 -16
- data/smoke/struct.rb +1 -1
- data/smoke/struct2.rb +1 -1
- data/smoke/struct3.rb +1 -1
- data/smoke/struct4.rb +1 -1
- data/smoke/struct5.rb +2 -2
- data/smoke/struct6.rb +2 -2
- data/smoke/struct7.rb +1 -1
- data/smoke/super1.rb +4 -4
- data/smoke/super3.rb +3 -2
- data/smoke/super4.rb +7 -5
- data/smoke/super5.rb +6 -4
- data/smoke/symbol-proc-attr.rb +1 -1
- data/smoke/tap1.rb +2 -2
- data/smoke/toplevel.rb +1 -1
- data/smoke/type_var.rb +3 -3
- data/smoke/user-demo.rb +1 -1
- data/smoke/wrong-extend.rb +1 -0
- data/smoke/wrong-include.rb +1 -0
- data/smoke/wrong-include2.rb +1 -1
- data/testbed/goodcheck-Gemfile.lock +1 -1
- data/typeprof.gemspec +1 -1
- metadata +25 -5
data/smoke/prepend1.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Mod
|
2
|
+
def foo
|
3
|
+
[42, super(:sym)]
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
class Foo
|
8
|
+
prepend Mod
|
9
|
+
|
10
|
+
def foo(sym_arg)
|
11
|
+
sym_arg.to_s
|
12
|
+
end
|
13
|
+
|
14
|
+
def bar
|
15
|
+
foo
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
__END__
|
20
|
+
# Errors
|
21
|
+
smoke/prepend1.rb:3: [error] no superclass method: Mod#foo
|
22
|
+
|
23
|
+
# Classes
|
24
|
+
module Mod
|
25
|
+
def foo: -> ([Integer, String | untyped])
|
26
|
+
end
|
27
|
+
|
28
|
+
class Foo
|
29
|
+
prepend Mod
|
30
|
+
|
31
|
+
def foo: (:sym | untyped sym_arg) -> (String | untyped)
|
32
|
+
def bar: -> ([Integer, String | untyped])
|
33
|
+
end
|
data/smoke/prepend2.rb
ADDED
data/smoke/prepend2.rbs
ADDED
data/smoke/proc4.rb
CHANGED
data/smoke/public.rb
CHANGED
data/smoke/range.rb
CHANGED
data/smoke/rbs-attr.rb
CHANGED
@@ -15,8 +15,8 @@ end
|
|
15
15
|
|
16
16
|
__END__
|
17
17
|
# Errors
|
18
|
-
smoke/rbs-attr.rb:11: [warning] inconsistent assignment to RBS-declared
|
19
|
-
smoke/rbs-attr.rb:13: [warning] inconsistent assignment to RBS-declared
|
18
|
+
smoke/rbs-attr.rb:11: [warning] inconsistent assignment to RBS-declared variable
|
19
|
+
smoke/rbs-attr.rb:13: [warning] inconsistent assignment to RBS-declared variable
|
20
20
|
|
21
21
|
# Classes
|
22
22
|
class Object
|
data/smoke/rbs-proc2.rb
CHANGED
data/smoke/rbs-proc3.rb
CHANGED
data/smoke/rbs-tyvar4.rb
CHANGED
@@ -31,6 +31,7 @@ __END__
|
|
31
31
|
# Classes
|
32
32
|
class Foo
|
33
33
|
@ivar: Array[Array[String]]
|
34
|
-
|
35
|
-
def
|
34
|
+
|
35
|
+
def initialize: (Array[Array[String]] ivar) -> Array[Array[String]]
|
36
|
+
def foo: (:a | :b n) -> nil
|
36
37
|
end
|
data/smoke/rbs-tyvar6.rb
CHANGED
@@ -12,7 +12,7 @@ __END__
|
|
12
12
|
# Classes
|
13
13
|
class Object
|
14
14
|
private
|
15
|
-
def log1: (Bar[String]) -> nil
|
16
|
-
def log2: (Array[String]) -> nil
|
17
|
-
def log3: (Integer) -> nil
|
15
|
+
def log1: (Bar[String] obj) -> nil
|
16
|
+
def log2: (Array[String] obj) -> nil
|
17
|
+
def log3: (Integer obj) -> nil
|
18
18
|
end
|
data/smoke/redo1.rb
CHANGED
data/smoke/redo2.rb
CHANGED
data/smoke/rescue1.rb
CHANGED
data/smoke/rescue2.rb
CHANGED
data/smoke/rescue3.rb
CHANGED
data/smoke/rescue4.rb
CHANGED
data/smoke/respond_to.rb
CHANGED
data/smoke/rest1.rb
CHANGED
@@ -21,6 +21,6 @@ __END__
|
|
21
21
|
# Classes
|
22
22
|
class Object
|
23
23
|
private
|
24
|
-
def foo: (:a | Integer | String, *Integer | String, :z | Integer | String) -> (Array[Integer | String])
|
25
|
-
def bar: (String, ?Integer | String, *String, String) -> Array[String]
|
24
|
+
def foo: (:a | Integer | String a, *Integer | String r, :z | Integer | String z) -> (Array[Integer | String])
|
25
|
+
def bar: (String a, ?Integer | String o, *String r, String z) -> Array[String]
|
26
26
|
end
|
data/smoke/rest2.rb
CHANGED
data/smoke/rest3.rb
CHANGED
@@ -28,10 +28,10 @@ __END__
|
|
28
28
|
# Classes
|
29
29
|
class Object
|
30
30
|
private
|
31
|
-
def foo: (*String) -> nil
|
32
|
-
def bar: (*Integer | String) -> nil
|
33
|
-
def baz: (String, *String) -> nil
|
34
|
-
def qux: (Integer, *String) -> nil
|
35
|
-
def corge: (*Integer | String, Integer | String) -> nil
|
36
|
-
def grault: (String, ?Integer | String, *String, String) -> nil
|
31
|
+
def foo: (*String r) -> nil
|
32
|
+
def bar: (*Integer | String r) -> nil
|
33
|
+
def baz: (String x, *String r) -> nil
|
34
|
+
def qux: (Integer x, *String r) -> nil
|
35
|
+
def corge: (*Integer | String r, Integer | String z) -> nil
|
36
|
+
def grault: (String a, ?Integer | String o, *String r, String z) -> nil
|
37
37
|
end
|
data/smoke/rest4.rb
CHANGED
data/smoke/rest5.rb
CHANGED
data/smoke/rest6.rb
CHANGED
data/smoke/retry1.rb
CHANGED
@@ -16,6 +16,6 @@ __END__
|
|
16
16
|
# Classes
|
17
17
|
class Object
|
18
18
|
private
|
19
|
-
def bar: (Integer | String) -> (Integer | String)
|
20
|
-
def foo: (Integer | String) -> (Integer | String)
|
19
|
+
def bar: (Integer | String x) -> (Integer | String)
|
20
|
+
def foo: (Integer | String x) -> (Integer | String)
|
21
21
|
end
|
data/smoke/simple.rb
CHANGED
data/smoke/step.rb
CHANGED
@@ -12,7 +12,7 @@ __END__
|
|
12
12
|
# Classes
|
13
13
|
class Object
|
14
14
|
private
|
15
|
-
def log1: (Integer | Numeric) -> nil
|
16
|
-
def log2: (void) -> nil
|
17
|
-
def log3: (Enumerator[Integer | Numeric]) -> nil
|
15
|
+
def log1: (Integer | Numeric x) -> nil
|
16
|
+
def log2: (void x) -> nil
|
17
|
+
def log3: (Enumerator[Integer | Numeric] x) -> nil
|
18
18
|
end
|
@@ -1,20 +1,10 @@
|
|
1
|
-
|
2
|
-
Foo
|
3
|
-
|
4
|
-
class Foo
|
5
|
-
def initialize(foo:)
|
6
|
-
super(foo: foo.to_s)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
Foo.new(42)
|
1
|
+
Foo = Struct.new(:a, :b, :c, keyword_init: true)
|
2
|
+
Foo[a: 1, b: "str", c: 1.0]
|
11
3
|
|
12
4
|
__END__
|
13
|
-
# Errors
|
14
|
-
smoke/struct-keyword_init.rb:10: [error] wrong number of arguments (given 1, expected 0)
|
15
|
-
|
16
5
|
# Classes
|
17
|
-
class Foo < Struct
|
18
|
-
attr_accessor
|
19
|
-
|
6
|
+
class Foo < Struct[untyped]
|
7
|
+
attr_accessor a(): Integer
|
8
|
+
attr_accessor b(): String
|
9
|
+
attr_accessor c(): Float
|
20
10
|
end
|
data/smoke/struct.rb
CHANGED
data/smoke/struct2.rb
CHANGED
data/smoke/struct3.rb
CHANGED
data/smoke/struct4.rb
CHANGED
data/smoke/struct5.rb
CHANGED
data/smoke/struct6.rb
CHANGED
@@ -6,10 +6,10 @@ end
|
|
6
6
|
|
7
7
|
__END__
|
8
8
|
# Classes
|
9
|
-
class AnonymousStruct_generated_1 < Struct
|
9
|
+
class AnonymousStruct_generated_1 < Struct[untyped]
|
10
10
|
attr_accessor foo(): untyped
|
11
11
|
end
|
12
12
|
|
13
13
|
class Foo < AnonymousStruct_generated_1
|
14
|
-
def initialize: (untyped) -> Foo
|
14
|
+
def initialize: (untyped foo) -> Foo
|
15
15
|
end
|
data/smoke/struct7.rb
CHANGED
data/smoke/super1.rb
CHANGED
@@ -35,7 +35,7 @@ __END__
|
|
35
35
|
# Classes
|
36
36
|
class Object
|
37
37
|
private
|
38
|
-
def log: (Baz) -> nil
|
38
|
+
def log: (Baz x) -> nil
|
39
39
|
end
|
40
40
|
|
41
41
|
class A
|
@@ -57,13 +57,13 @@ class Z
|
|
57
57
|
end
|
58
58
|
|
59
59
|
class Foo
|
60
|
-
def f: (C) -> X
|
60
|
+
def f: (C x) -> X
|
61
61
|
end
|
62
62
|
|
63
63
|
class Bar < Foo
|
64
|
-
def f: (B) -> Y
|
64
|
+
def f: (B x) -> Y
|
65
65
|
end
|
66
66
|
|
67
67
|
class Baz < Bar
|
68
|
-
def f: (A) -> Z
|
68
|
+
def f: (A x) -> Z
|
69
69
|
end
|