typeprof 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module TypeProf
2
- VERSION = "0.6.1"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -8,5 +8,5 @@ end
8
8
  __END__
9
9
  # Classes
10
10
  class Object
11
- def log : (untyped) -> nil
11
+ def log : (bot) -> nil
12
12
  end
@@ -0,0 +1,70 @@
1
+ def f1(*ary)
2
+ ary[1..3]
3
+ end
4
+
5
+ def f2(*ary)
6
+ ary[1...3]
7
+ end
8
+
9
+ def f3(*ary)
10
+ ary[1..-3]
11
+ end
12
+
13
+ def f4(*ary)
14
+ ary[1...-3]
15
+ end
16
+
17
+ def f5(*ary)
18
+ ary[-4..3]
19
+ end
20
+
21
+ def f6(*ary)
22
+ ary[-4...3]
23
+ end
24
+
25
+ def f7(*ary)
26
+ ary[-4..-3]
27
+ end
28
+
29
+ def f8(*ary)
30
+ ary[-4...-3]
31
+ end
32
+
33
+ def f9(*ary)
34
+ ary[...3]
35
+ end
36
+
37
+ def f10(*ary)
38
+ ary[3..]
39
+ end
40
+
41
+ def dispatch(*ary)
42
+ f1(*ary)
43
+ f2(*ary)
44
+ f3(*ary)
45
+ f4(*ary)
46
+ f5(*ary)
47
+ f6(*ary)
48
+ f7(*ary)
49
+ f8(*ary)
50
+ f9(*ary)
51
+ f10(*ary)
52
+ end
53
+
54
+ dispatch(:a, :b, :c, :d, :e)
55
+
56
+ __END__
57
+ # Classes
58
+ class Object
59
+ def f1 : (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
60
+ def f2 : (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
61
+ def f3 : (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
62
+ def f4 : (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
63
+ def f5 : (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
64
+ def f6 : (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
65
+ def f7 : (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
66
+ def f8 : (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
67
+ def f9 : (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
68
+ def f10 : (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
69
+ def dispatch : (*:a | :b | :c | :d | :e) -> (Array[:a | :b | :c | :d | :e])
70
+ end
@@ -0,0 +1,13 @@
1
+ autoload(:Pathname, "pathname")
2
+
3
+ def foo
4
+ Pathname.new("foo")
5
+ end
6
+
7
+ foo
8
+
9
+ __END__
10
+ # Classes
11
+ class Object
12
+ def foo : -> Pathname
13
+ end
@@ -0,0 +1,16 @@
1
+ class Foo
2
+ def bar(n)
3
+ :BAR
4
+ end
5
+
6
+ define_method(:foo) do |n|
7
+ bar(:FOO)
8
+ end
9
+ end
10
+
11
+ __END__
12
+ # Classes
13
+ class Foo
14
+ def bar : (:FOO | untyped) -> :BAR
15
+ def foo : (untyped) -> :BAR
16
+ end
@@ -0,0 +1,18 @@
1
+ class C
2
+ x = :x
3
+ define_method(:foo) do
4
+ x
5
+ end
6
+ define_method(:bar) do
7
+ x
8
+ end
9
+ end
10
+
11
+ C.new.foo
12
+
13
+ __END__
14
+ # Classes
15
+ class C
16
+ def foo : -> :x
17
+ def bar : -> :x
18
+ end
@@ -0,0 +1,12 @@
1
+ class Foo
2
+ def foo(**r)
3
+ @r = r[42]
4
+ end
5
+ end
6
+
7
+ __END__
8
+ # Classes
9
+ class Foo
10
+ @r : Integer
11
+ # def foo : (**Hash[Integer, Integer]) -> void
12
+ end
@@ -0,0 +1,3 @@
1
+ class Foo
2
+ def foo: (**Hash[Integer, Integer]) -> void
3
+ end
@@ -0,0 +1,28 @@
1
+ class D
2
+ def foo(x, y, z)
3
+ end
4
+ end
5
+
6
+ class C
7
+ def initialize(x)
8
+ @target = x
9
+ end
10
+
11
+ def method_missing(m, *args)
12
+ @target.send(m, *args)
13
+ end
14
+ end
15
+
16
+ C.new(D.new).foo(:X, :Y, :Z)
17
+
18
+ __END__
19
+ # Classes
20
+ class D
21
+ def foo : (:X, :Y, :Z) -> nil
22
+ end
23
+
24
+ class C
25
+ @target : D
26
+ def initialize : (D) -> D
27
+ def method_missing : (:foo, *:X | :Y | :Z) -> nil
28
+ end
@@ -15,8 +15,8 @@ end
15
15
 
16
16
  __END__
17
17
  # Errors
18
- smoke/rbs-attr.rb:11: [error] failed to resolve overload: Foo#writer_example=
19
- smoke/rbs-attr.rb:13: [error] failed to resolve overload: Foo#accessor_example=
18
+ smoke/rbs-attr.rb:11: [warning] inconsistent assignment to RBS-declared global variable
19
+ smoke/rbs-attr.rb:13: [warning] inconsistent assignment to RBS-declared global variable
20
20
 
21
21
  # Classes
22
22
  class Object
@@ -0,0 +1,11 @@
1
+ class Foo
2
+ def foo
3
+ @name
4
+ end
5
+ end
6
+
7
+ __END__
8
+ # Classes
9
+ class Foo
10
+ def foo : -> String
11
+ end
@@ -0,0 +1,3 @@
1
+ class Foo
2
+ attr_reader name: String
3
+ end
@@ -0,0 +1,11 @@
1
+ def foo
2
+ bar = Bar.new(1)
3
+ bar.set(["str"]) # TODO: This should update Bar[Integer] to Bar[Integer | String]
4
+ bar
5
+ end
6
+
7
+ __END__
8
+ # Classes
9
+ class Object
10
+ def foo : -> Bar[Integer]
11
+ end
@@ -0,0 +1,7 @@
1
+ class Foo[X]
2
+ def set: (X) -> void
3
+ end
4
+
5
+ class Bar[X] < Foo[Integer]
6
+ def initialize: (X) -> void
7
+ end
@@ -30,8 +30,6 @@ class Object
30
30
  end
31
31
 
32
32
  class Foo
33
- # @ivar : :ivar_example
34
- # @@cvar : :cvar_example
35
33
  def const_test : -> :const_example
36
34
  def ivar_test : -> :ivar_example
37
35
  def cvar_test : -> :cvar_example
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.6.1
4
+ version: 0.7.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-18 00:00:00.000000000 Z
11
+ date: 2020-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs
@@ -84,6 +84,7 @@ files:
84
84
  - smoke/array-plus1.rb
85
85
  - smoke/array-plus2.rb
86
86
  - smoke/array-pop.rb
87
+ - smoke/array-range-aref.rb
87
88
  - smoke/array-replace.rb
88
89
  - smoke/array-s-aref.rb
89
90
  - smoke/array1.rb
@@ -101,6 +102,7 @@ files:
101
102
  - smoke/array8.rb
102
103
  - smoke/array9.rb
103
104
  - smoke/attr.rb
105
+ - smoke/autoload.rb
104
106
  - smoke/backtrace.rb
105
107
  - smoke/block-ambiguous.rb
106
108
  - smoke/block-args1-rest.rb
@@ -145,6 +147,8 @@ files:
145
147
  - smoke/context-sensitive1.rb
146
148
  - smoke/cvar.rb
147
149
  - smoke/cvar2.rb
150
+ - smoke/define_method.rb
151
+ - smoke/define_method2.rb
148
152
  - smoke/demo.rb
149
153
  - smoke/demo1.rb
150
154
  - smoke/demo10.rb
@@ -201,6 +205,8 @@ files:
201
205
  - smoke/keyword3.rb
202
206
  - smoke/keyword4.rb
203
207
  - smoke/keyword5.rb
208
+ - smoke/kwrest.rb
209
+ - smoke/kwrest.rbs
204
210
  - smoke/kwsplat1.rb
205
211
  - smoke/kwsplat2.rb
206
212
  - smoke/manual-rbs.rb
@@ -213,6 +219,7 @@ files:
213
219
  - smoke/masgn2.rb
214
220
  - smoke/masgn3.rb
215
221
  - smoke/method_in_branch.rb
222
+ - smoke/method_missing.rb
216
223
  - smoke/module1.rb
217
224
  - smoke/module2.rb
218
225
  - smoke/module3.rb
@@ -244,6 +251,8 @@ files:
244
251
  - smoke/rbs-alias.rbs
245
252
  - smoke/rbs-attr.rb
246
253
  - smoke/rbs-attr.rbs
254
+ - smoke/rbs-attr2.rb
255
+ - smoke/rbs-attr2.rbs
247
256
  - smoke/rbs-extend.rb
248
257
  - smoke/rbs-extend.rbs
249
258
  - smoke/rbs-interface.rb
@@ -267,6 +276,8 @@ files:
267
276
  - smoke/rbs-tyvar5.rbs
268
277
  - smoke/rbs-tyvar6.rb
269
278
  - smoke/rbs-tyvar6.rbs
279
+ - smoke/rbs-tyvar7.rb
280
+ - smoke/rbs-tyvar7.rbs
270
281
  - smoke/rbs-vars.rb
271
282
  - smoke/rbs-vars.rbs
272
283
  - smoke/redo1.rb