typeprof 0.12.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -10
- data/lib/typeprof/analyzer.rb +236 -117
- data/lib/typeprof/block.rb +7 -6
- data/lib/typeprof/builtin.rb +63 -17
- data/lib/typeprof/cli.rb +1 -0
- data/lib/typeprof/config.rb +10 -15
- data/lib/typeprof/export.rb +10 -10
- data/lib/typeprof/import.rb +60 -22
- data/lib/typeprof/iseq.rb +100 -41
- data/lib/typeprof/type.rb +96 -46
- data/lib/typeprof/version.rb +1 -1
- data/smoke/alias2.rb +1 -1
- data/smoke/array3.rb +1 -1
- data/smoke/attr-module.rb +1 -4
- data/smoke/attr-vis.rb +1 -1
- data/smoke/attr.rb +1 -1
- data/smoke/break4.rb +17 -0
- data/smoke/class_eval.rb +22 -0
- data/smoke/define_method7.rb +18 -0
- data/smoke/extended.rb +38 -0
- data/smoke/flow11.rb +17 -0
- data/smoke/huge_union.rb +86 -0
- data/smoke/included.rb +38 -0
- data/smoke/inherited.rb +26 -0
- data/smoke/initialize.rb +1 -1
- data/smoke/instance_eval.rb +1 -1
- data/smoke/instance_eval4.rb +12 -0
- data/smoke/ivar2.rb +1 -1
- data/smoke/ivar3.rb +1 -1
- data/smoke/kwrest.rb +2 -2
- data/smoke/kwrest.rbs +1 -1
- data/smoke/method_missing.rb +1 -1
- data/smoke/noname.rb +9 -0
- data/smoke/proc6.rb +13 -0
- data/smoke/proc7.rb +32 -0
- data/smoke/rbs-tyvar4.rb +1 -1
- data/smoke/require1.rb +13 -0
- data/smoke/require2.rb +13 -0
- data/smoke/struct5.rb +1 -1
- data/smoke/struct6.rb +1 -1
- data/smoke/struct7.rb +1 -1
- data/smoke/super3.rb +1 -1
- data/smoke/symbol-proc-attr.rb +1 -1
- data/smoke/symbol-proc-attr2.rb +1 -1
- data/typeprof.gemspec +1 -1
- metadata +19 -5
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
|
data/smoke/inherited.rb
ADDED
@@ -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
data/smoke/instance_eval.rb
CHANGED
data/smoke/ivar2.rb
CHANGED
data/smoke/ivar3.rb
CHANGED
data/smoke/kwrest.rb
CHANGED
data/smoke/kwrest.rbs
CHANGED
data/smoke/method_missing.rb
CHANGED
data/smoke/noname.rb
ADDED
data/smoke/proc6.rb
ADDED
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
data/smoke/require1.rb
ADDED
data/smoke/require2.rb
ADDED
data/smoke/struct5.rb
CHANGED
data/smoke/struct6.rb
CHANGED
data/smoke/struct7.rb
CHANGED
data/smoke/super3.rb
CHANGED
data/smoke/symbol-proc-attr.rb
CHANGED
data/smoke/symbol-proc-attr2.rb
CHANGED
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.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-
|
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.
|
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.
|
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.
|
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
|