typeprof 0.12.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
data/smoke/included.rb ADDED
@@ -0,0 +1,38 @@
1
+ module Foo
2
+ @included = []
3
+ def self.included(klass)
4
+ @included << klass
5
+ end
6
+ end
7
+
8
+ class C
9
+ include Foo
10
+ end
11
+
12
+ class D
13
+ include Foo
14
+ end
15
+
16
+ class E
17
+ include Foo
18
+ end
19
+
20
+ __END__
21
+ # Classes
22
+ module Foo
23
+ self.@included: Array[singleton(C) | singleton(D) | singleton(E)]
24
+
25
+ def self.included: (singleton(C) | singleton(D) | singleton(E) klass) -> (Array[singleton(C) | singleton(D) | singleton(E)])
26
+ end
27
+
28
+ class C
29
+ include Foo
30
+ end
31
+
32
+ class D
33
+ include Foo
34
+ end
35
+
36
+ class E
37
+ include Foo
38
+ end
@@ -0,0 +1,26 @@
1
+ class Foo
2
+ @inherited = []
3
+ def self.inherited(klass)
4
+ @inherited << klass
5
+ end
6
+ end
7
+
8
+ class Bar < Foo
9
+ end
10
+
11
+ class Baz < Foo
12
+ end
13
+
14
+ __END__
15
+ # Classes
16
+ class Foo
17
+ self.@inherited: Array[singleton(Bar) | singleton(Baz)]
18
+
19
+ def self.inherited: (singleton(Bar) | singleton(Baz) klass) -> (Array[singleton(Bar) | singleton(Baz)])
20
+ end
21
+
22
+ class Bar < Foo
23
+ end
24
+
25
+ class Baz < Foo
26
+ end
data/smoke/initialize.rb CHANGED
@@ -24,5 +24,5 @@ class A
24
24
  @str: String
25
25
  @val: (Integer | String)?
26
26
 
27
- def initialize: ((Integer | String)? x) -> ((Integer | String)?)
27
+ def initialize: ((Integer | String)? x) -> void
28
28
  end
@@ -13,6 +13,6 @@ end
13
13
  __END__
14
14
  # Classes
15
15
  class C
16
- def self.foo: { (C) -> nil } -> C
16
+ def self.foo: { (C) -> nil } -> nil
17
17
  def log: (Integer n) -> nil
18
18
  end
@@ -0,0 +1,12 @@
1
+ def foo
2
+ 5.instance_eval { i }
3
+ end
4
+
5
+ foo
6
+
7
+ __END__
8
+ # Classes
9
+ class Object
10
+ private
11
+ def foo: -> Complex
12
+ end
data/smoke/ivar2.rb CHANGED
@@ -23,7 +23,7 @@ Foo.new.set
23
23
  __END__
24
24
  # Classes
25
25
  class Foo
26
- def initialize: -> Hash[bot, bot]
26
+ def initialize: -> void
27
27
  def set: -> :sym
28
28
  attr_reader array: Array[:sym | Integer | String]
29
29
  attr_reader hash: {a: Integer, b: String, c: :sym}
data/smoke/ivar3.rb CHANGED
@@ -13,5 +13,5 @@ smoke/ivar3.rb:3: [warning] inconsistent assignment to RBS-declared variable
13
13
  class Foo
14
14
  @bar: String
15
15
 
16
- def initialize: -> String
16
+ def initialize: -> void
17
17
  end
data/smoke/kwrest.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class Foo
2
2
  def foo(**r)
3
- @r = r[42]
3
+ @r = r["foo".to_sym][42]
4
4
  end
5
5
  end
6
6
 
@@ -9,5 +9,5 @@ __END__
9
9
  class Foo
10
10
  @r: Integer
11
11
 
12
- # def foo: (**Hash[Integer, Integer]) -> void
12
+ # def foo: (**Integer) -> void
13
13
  end
data/smoke/kwrest.rbs CHANGED
@@ -1,3 +1,3 @@
1
1
  class Foo
2
- def foo: (**Hash[Integer, Integer]) -> void
2
+ def foo: (**Integer) -> void
3
3
  end
@@ -24,6 +24,6 @@ end
24
24
  class C
25
25
  @target: D
26
26
 
27
- def initialize: (D x) -> D
27
+ def initialize: (D x) -> void
28
28
  def method_missing: (:foo m, *:X | :Y | :Z args) -> nil
29
29
  end
data/smoke/noname.rb ADDED
@@ -0,0 +1,9 @@
1
+ def foo(*)
2
+ end
3
+
4
+ __END__
5
+ # Classes
6
+ class Object
7
+ private
8
+ def foo: (*untyped noname_2) -> nil
9
+ end
data/smoke/proc6.rb ADDED
@@ -0,0 +1,13 @@
1
+ # a test for a recursive proc that receives (or returns) itself
2
+ def foo
3
+ f = -> x { x }
4
+ f[f]
5
+ f
6
+ end
7
+
8
+ __END__
9
+ # Classes
10
+ class Object
11
+ private
12
+ def foo: -> ^(untyped) -> untyped
13
+ end
data/smoke/proc7.rb ADDED
@@ -0,0 +1,32 @@
1
+ class Foo
2
+ def id(&blk)
3
+ blk
4
+ end
5
+
6
+ def check(v)
7
+ rand < 0.5 ? v : [v]
8
+ end
9
+
10
+ def foo
11
+ check(id {}).call # cause "undefined method: [^-> nil?]#call"
12
+ end
13
+
14
+ def foo1
15
+ id { }
16
+ end
17
+ end
18
+
19
+ __END__
20
+ # Errors
21
+ smoke/proc7.rb:11: [error] undefined method: nil#call
22
+ smoke/proc7.rb:11: [error] undefined method: [(^(unknown) -> bot | untyped)?]#call
23
+ smoke/proc7.rb:11: [error] undefined method: nil#call
24
+ smoke/proc7.rb:11: [error] undefined method: [(^-> nil | untyped)?]#call
25
+
26
+ # Classes
27
+ class Foo
28
+ def id: ?{ -> nil } -> ^-> nil?
29
+ def check: ((^-> nil | untyped)? v) -> (([(^-> nil | untyped)?] | ^-> nil | untyped)?)
30
+ def foo: -> untyped?
31
+ def foo1: -> ^-> nil?
32
+ end
data/smoke/rbs-tyvar4.rb CHANGED
@@ -32,6 +32,6 @@ __END__
32
32
  class Foo
33
33
  @ivar: Array[Array[String]]
34
34
 
35
- def initialize: (Array[Array[String]] ivar) -> Array[Array[String]]
35
+ def initialize: (Array[Array[String]] ivar) -> void
36
36
  def foo: (:a | :b n) -> nil
37
37
  end
data/smoke/require1.rb ADDED
@@ -0,0 +1,13 @@
1
+ require_relative "require2"
2
+
3
+ class Foo
4
+ def foo
5
+ end
6
+ end
7
+
8
+ __END__
9
+ # Classes
10
+ class Foo
11
+ def bar: -> nil
12
+ def foo: -> nil
13
+ end
data/smoke/require2.rb ADDED
@@ -0,0 +1,13 @@
1
+ require_relative "require1"
2
+
3
+ class Foo
4
+ def bar
5
+ end
6
+ end
7
+
8
+ __END__
9
+ # Classes
10
+ class Foo
11
+ def foo: -> nil
12
+ def bar: -> nil
13
+ end
data/smoke/struct5.rb CHANGED
@@ -12,5 +12,5 @@ __END__
12
12
  # Classes
13
13
  class Foo < Struct[untyped]
14
14
  attr_accessor foo(): String
15
- def initialize: (Integer foo) -> Foo
15
+ def initialize: (Integer foo) -> void
16
16
  end
data/smoke/struct6.rb CHANGED
@@ -11,5 +11,5 @@ class AnonymousStruct_generated_1 < Struct[untyped]
11
11
  end
12
12
 
13
13
  class Foo < AnonymousStruct_generated_1
14
- def initialize: (untyped foo) -> Foo
14
+ def initialize: (untyped foo) -> void
15
15
  end
data/smoke/struct7.rb CHANGED
@@ -13,5 +13,5 @@ end
13
13
  __END__
14
14
  # Classes
15
15
  class Foo < Struct[untyped]
16
- def initialize: -> Foo
16
+ def initialize: -> void
17
17
  end
data/smoke/super3.rb CHANGED
@@ -16,5 +16,5 @@ class Foo
16
16
  @a: Integer
17
17
 
18
18
  def self.new: (Integer a) -> Foo
19
- def initialize: (Integer a) -> Integer
19
+ def initialize: (Integer a) -> void
20
20
  end
@@ -18,5 +18,5 @@ end
18
18
 
19
19
  class Foo
20
20
  attr_reader foo: Integer | untyped
21
- def initialize: (Integer | untyped foo) -> (Integer | untyped)
21
+ def initialize: (Integer | untyped foo) -> void
22
22
  end
@@ -11,5 +11,5 @@ __END__
11
11
  # Classes
12
12
  class Foo
13
13
  attr_reader foo: [Integer]
14
- def initialize: -> [Integer]
14
+ def initialize: -> void
15
15
  end
data/typeprof.gemspec CHANGED
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_runtime_dependency "rbs", ">= 1.0.0"
33
+ spec.add_runtime_dependency "rbs", ">= 1.3.1"
34
34
  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.12.0
4
+ version: 0.15.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: 2021-01-29 00:00:00.000000000 Z
11
+ date: 2021-07-21 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: 1.0.0
19
+ version: 1.3.1
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: 1.0.0
26
+ version: 1.3.1
27
27
  description: |
28
28
  TypeProf performs a type analysis of non-annotated Ruby code.
29
29
 
@@ -138,6 +138,7 @@ files:
138
138
  - smoke/break1.rb
139
139
  - smoke/break2.rb
140
140
  - smoke/break3.rb
141
+ - smoke/break4.rb
141
142
  - smoke/case.rb
142
143
  - smoke/case2.rb
143
144
  - smoke/case3.rb
@@ -145,6 +146,7 @@ files:
145
146
  - smoke/class-hierarchy2.rb
146
147
  - smoke/class-new.rb
147
148
  - smoke/class.rb
149
+ - smoke/class_eval.rb
148
150
  - smoke/class_instance_var.rb
149
151
  - smoke/class_method.rb
150
152
  - smoke/class_method2.rb
@@ -164,6 +166,7 @@ files:
164
166
  - smoke/define_method4.rbs
165
167
  - smoke/define_method5.rb
166
168
  - smoke/define_method6.rb
169
+ - smoke/define_method7.rb
167
170
  - smoke/demo.rb
168
171
  - smoke/demo1.rb
169
172
  - smoke/demo10.rb
@@ -185,10 +188,12 @@ files:
185
188
  - smoke/enumerator.rb
186
189
  - smoke/expandarray1.rb
187
190
  - smoke/expandarray2.rb
191
+ - smoke/extended.rb
188
192
  - smoke/fib.rb
189
193
  - smoke/flip-flop.rb
190
194
  - smoke/flow1.rb
191
195
  - smoke/flow10.rb
196
+ - smoke/flow11.rb
192
197
  - smoke/flow2.rb
193
198
  - smoke/flow3.rb
194
199
  - smoke/flow4.rb
@@ -211,12 +216,16 @@ files:
211
216
  - smoke/hash3.rb
212
217
  - smoke/hash4.rb
213
218
  - smoke/hash5.rb
219
+ - smoke/huge_union.rb
220
+ - smoke/included.rb
214
221
  - smoke/inheritance.rb
215
222
  - smoke/inheritance2.rb
223
+ - smoke/inherited.rb
216
224
  - smoke/initialize.rb
217
225
  - smoke/instance_eval.rb
218
226
  - smoke/instance_eval2.rb
219
227
  - smoke/instance_eval3.rb
228
+ - smoke/instance_eval4.rb
220
229
  - smoke/int_times.rb
221
230
  - smoke/integer.rb
222
231
  - smoke/ivar.rb
@@ -259,6 +268,7 @@ files:
259
268
  - smoke/multiple-superclass.rb
260
269
  - smoke/next1.rb
261
270
  - smoke/next2.rb
271
+ - smoke/noname.rb
262
272
  - smoke/object-send1.rb
263
273
  - smoke/object-send2.rb
264
274
  - smoke/object-send3.rb
@@ -282,6 +292,8 @@ files:
282
292
  - smoke/proc3.rb
283
293
  - smoke/proc4.rb
284
294
  - smoke/proc5.rb
295
+ - smoke/proc6.rb
296
+ - smoke/proc7.rb
285
297
  - smoke/public.rb
286
298
  - smoke/range.rb
287
299
  - smoke/rbs-alias.rb
@@ -324,6 +336,8 @@ files:
324
336
  - smoke/redo1.rb
325
337
  - smoke/redo2.rb
326
338
  - smoke/req-keyword.rb
339
+ - smoke/require1.rb
340
+ - smoke/require2.rb
327
341
  - smoke/rescue1.rb
328
342
  - smoke/rescue2.rb
329
343
  - smoke/rescue3.rb
@@ -403,7 +417,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
403
417
  - !ruby/object:Gem::Version
404
418
  version: '0'
405
419
  requirements: []
406
- rubygems_version: 3.2.3
420
+ rubygems_version: 3.2.15
407
421
  signing_key:
408
422
  specification_version: 4
409
423
  summary: TypeProf is a type analysis tool for Ruby code based on abstract interpretation