raap 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +31 -0
- data/README.md +32 -3
- data/Rakefile +10 -1
- data/exe/raap +4 -1
- data/lib/raap/bind_call.rb +21 -7
- data/lib/raap/cli.rb +211 -125
- data/lib/raap/function_type.rb +14 -10
- data/lib/raap/method_property.rb +60 -28
- data/lib/raap/method_type.rb +13 -6
- data/lib/raap/minitest.rb +9 -3
- data/lib/raap/rbs.rb +19 -0
- data/lib/raap/result.rb +84 -8
- data/lib/raap/sized.rb +2 -0
- data/lib/raap/symbolic_caller.rb +38 -26
- data/lib/raap/type.rb +111 -115
- data/lib/raap/type_substitution.rb +5 -1
- data/lib/raap/value/bottom.rb +2 -0
- data/lib/raap/value/interface.rb +61 -27
- data/lib/raap/value/intersection.rb +26 -21
- data/lib/raap/value/module.rb +50 -7
- data/lib/raap/value/top.rb +2 -0
- data/lib/raap/value/variable.rb +12 -1
- data/lib/raap/value/void.rb +2 -0
- data/lib/raap/version.rb +1 -1
- data/lib/raap.rb +3 -2
- data/public/jacket.webp +0 -0
- data/rbs_collection.lock.yaml +61 -1
- data/rbs_collection.yaml +0 -1
- data/sig/raap.rbs +63 -34
- data/sig/shims.rbs +4 -0
- metadata +10 -9
data/lib/raap/value/variable.rb
CHANGED
@@ -1,10 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RaaP
|
2
4
|
module Value
|
3
5
|
class Variable < BasicObject
|
4
6
|
attr_reader :type
|
5
7
|
|
6
8
|
def initialize(type)
|
7
|
-
@type =
|
9
|
+
@type =
|
10
|
+
if type.respond_to?(:to_sym)
|
11
|
+
# @type var type: String | Symbol
|
12
|
+
::RBS::Types::Variable.new(name: type.to_sym, location: nil)
|
13
|
+
else
|
14
|
+
type
|
15
|
+
end
|
16
|
+
unless @type.instance_of?(::RBS::Types::Variable)
|
17
|
+
::Kernel.raise ::TypeError, "not a variable type: #{@type}"
|
18
|
+
end
|
8
19
|
end
|
9
20
|
|
10
21
|
def inspect = "#<var #{type}>"
|
data/lib/raap/value/void.rb
CHANGED
data/lib/raap/version.rb
CHANGED
data/lib/raap.rb
CHANGED
@@ -15,7 +15,9 @@ module RaaP
|
|
15
15
|
attr_accessor :logger
|
16
16
|
end
|
17
17
|
|
18
|
-
self.logger = ::Logger.new($stdout
|
18
|
+
self.logger = ::Logger.new($stdout, formatter: proc { |severity, _datetime, _progname, msg|
|
19
|
+
"[RaaP] #{severity}: #{msg}\n"
|
20
|
+
})
|
19
21
|
self.logger.level = ::Logger::INFO
|
20
22
|
|
21
23
|
autoload :BindCall, "raap/bind_call"
|
@@ -23,7 +25,6 @@ module RaaP
|
|
23
25
|
autoload :FunctionType, "raap/function_type"
|
24
26
|
autoload :MethodProperty, "raap/method_property"
|
25
27
|
autoload :MethodType, "raap/method_type"
|
26
|
-
autoload :Minitest, "raap/minitest"
|
27
28
|
autoload :RBS, "raap/rbs"
|
28
29
|
autoload :Result, "raap/result"
|
29
30
|
autoload :Sized, "raap/sized"
|
data/public/jacket.webp
ADDED
Binary file
|
data/rbs_collection.lock.yaml
CHANGED
@@ -5,10 +5,58 @@ gems:
|
|
5
5
|
version: '0'
|
6
6
|
source:
|
7
7
|
type: stdlib
|
8
|
+
- name: activesupport
|
9
|
+
version: '7.0'
|
10
|
+
source:
|
11
|
+
type: git
|
12
|
+
name: ruby/gem_rbs_collection
|
13
|
+
revision: bc4cbee282cfb013be8c44a3fe7a374491492400
|
14
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
15
|
+
repo_dir: gems
|
16
|
+
- name: base64
|
17
|
+
version: '0'
|
18
|
+
source:
|
19
|
+
type: stdlib
|
20
|
+
- name: bigdecimal
|
21
|
+
version: '0'
|
22
|
+
source:
|
23
|
+
type: stdlib
|
24
|
+
- name: concurrent-ruby
|
25
|
+
version: '1.1'
|
26
|
+
source:
|
27
|
+
type: git
|
28
|
+
name: ruby/gem_rbs_collection
|
29
|
+
revision: bc4cbee282cfb013be8c44a3fe7a374491492400
|
30
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
31
|
+
repo_dir: gems
|
32
|
+
- name: connection_pool
|
33
|
+
version: '2.4'
|
34
|
+
source:
|
35
|
+
type: git
|
36
|
+
name: ruby/gem_rbs_collection
|
37
|
+
revision: bc4cbee282cfb013be8c44a3fe7a374491492400
|
38
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
39
|
+
repo_dir: gems
|
40
|
+
- name: date
|
41
|
+
version: '0'
|
42
|
+
source:
|
43
|
+
type: stdlib
|
44
|
+
- name: erb
|
45
|
+
version: '0'
|
46
|
+
source:
|
47
|
+
type: stdlib
|
8
48
|
- name: fileutils
|
9
49
|
version: '0'
|
10
50
|
source:
|
11
51
|
type: stdlib
|
52
|
+
- name: i18n
|
53
|
+
version: '1.10'
|
54
|
+
source:
|
55
|
+
type: git
|
56
|
+
name: ruby/gem_rbs_collection
|
57
|
+
revision: bc4cbee282cfb013be8c44a3fe7a374491492400
|
58
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
59
|
+
repo_dir: gems
|
12
60
|
- name: io-console
|
13
61
|
version: '0'
|
14
62
|
source:
|
@@ -46,7 +94,7 @@ gems:
|
|
46
94
|
source:
|
47
95
|
type: git
|
48
96
|
name: ruby/gem_rbs_collection
|
49
|
-
revision:
|
97
|
+
revision: bc4cbee282cfb013be8c44a3fe7a374491492400
|
50
98
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
51
99
|
repo_dir: gems
|
52
100
|
- name: rbs
|
@@ -57,6 +105,18 @@ gems:
|
|
57
105
|
version: '0'
|
58
106
|
source:
|
59
107
|
type: stdlib
|
108
|
+
- name: securerandom
|
109
|
+
version: '0'
|
110
|
+
source:
|
111
|
+
type: stdlib
|
112
|
+
- name: singleton
|
113
|
+
version: '0'
|
114
|
+
source:
|
115
|
+
type: stdlib
|
116
|
+
- name: time
|
117
|
+
version: '0'
|
118
|
+
source:
|
119
|
+
type: stdlib
|
60
120
|
- name: timeout
|
61
121
|
version: '0'
|
62
122
|
source:
|
data/rbs_collection.yaml
CHANGED
data/sig/raap.rbs
CHANGED
@@ -6,8 +6,8 @@ module RaaP
|
|
6
6
|
def self.logger=: (::Logger) -> void
|
7
7
|
|
8
8
|
module BindCall
|
9
|
-
def self.
|
10
|
-
def self.respond_to?: (untyped,
|
9
|
+
def self.define_method: (untyped, Symbol) { (*untyped, **untyped) -> untyped } -> void
|
10
|
+
def self.respond_to?: (untyped, untyped, ?boolish) -> bool
|
11
11
|
def self.instance_of?: (untyped, Module) -> bool
|
12
12
|
def self.is_a?: (untyped, Module) -> bool
|
13
13
|
def self.extend: (untyped, Module) -> void
|
@@ -46,33 +46,41 @@ module RaaP
|
|
46
46
|
attr_accessor allow_private: bool
|
47
47
|
end
|
48
48
|
|
49
|
+
type property_result = [Integer, Symbol, ::RBS::MethodType, StringIO?]
|
50
|
+
|
51
|
+
DEFAULT_SKIP: ::Set[String]
|
52
|
+
|
49
53
|
@argv: Array[String]
|
54
|
+
@option: Option
|
55
|
+
@results: Array[{ method: ::RBS::Definition::Method, properties: Array[property_result] }]
|
56
|
+
@skip: ::Set[::String]
|
50
57
|
|
51
58
|
def self.option: () -> Option
|
52
59
|
def self.option=: (Option) -> void
|
53
60
|
|
54
61
|
def initialize: (Array[String]) -> void
|
55
62
|
def load: () -> self
|
63
|
+
def run: () -> Integer
|
64
|
+
|
65
|
+
private
|
56
66
|
|
57
|
-
|
58
|
-
def
|
59
|
-
def
|
60
|
-
def
|
61
|
-
def
|
62
|
-
def run_by_type_name: (tag: String) -> Array[Array[property_result]]
|
63
|
-
def run_by_type_name_with_search: (tag: String) -> Array[Array[property_result]]
|
64
|
-
def property: (receiver_type: Type, type_params_decl: Array[::RBS::AST::TypeParam], method_name: Symbol, method_type: ::RBS::MethodType) -> property_result
|
67
|
+
def run_by: (kind: (:instance | :singleton), tag: String) -> void
|
68
|
+
def run_by_type_name: (tag: String) -> void
|
69
|
+
def run_by_type_name_with_search: (tag: String) -> void
|
70
|
+
def property: (receiver_type: Type, type_params_decl: Array[::RBS::AST::TypeParam], type_args: Array[::RBS::Types::t], method_name: Symbol, method_type: ::RBS::MethodType) -> property_result
|
71
|
+
def report: () -> Integer
|
65
72
|
end
|
66
73
|
|
67
74
|
class FunctionType
|
68
75
|
@fun: ::RBS::Types::Function
|
69
76
|
|
70
77
|
def initialize: (::RBS::Types::Function) -> void
|
71
|
-
def pick_arguments: (?size: Integer
|
78
|
+
def pick_arguments: (?size: Integer) -> [Array[untyped], Hash[Symbol, untyped]]
|
79
|
+
def arguments_to_symbolic_call: (?size: Integer) -> [Array[untyped], Hash[Symbol, untyped]]
|
72
80
|
|
73
81
|
private
|
74
82
|
|
75
|
-
def
|
83
|
+
def to_symbolic_call_recursive: (untyped, size: Integer) -> untyped
|
76
84
|
def build_args_type: () -> Array[Type]
|
77
85
|
def build_kwargs_type: () -> Hash[Symbol, Type]
|
78
86
|
end
|
@@ -82,6 +90,7 @@ module RaaP
|
|
82
90
|
attr_accessor success: Integer
|
83
91
|
attr_accessor skip: Integer
|
84
92
|
attr_accessor exception: Integer
|
93
|
+
attr_accessor break: bool
|
85
94
|
end
|
86
95
|
|
87
96
|
@receiver_type: Type
|
@@ -97,7 +106,7 @@ module RaaP
|
|
97
106
|
private
|
98
107
|
|
99
108
|
def call: (size: Integer, stats: Stats) -> (Result::Success | Result::Failure | Result::Skip | Result::Exception)
|
100
|
-
def check_return: (receiver_value: untyped, return_value: untyped
|
109
|
+
def check_return: (receiver_value: untyped, return_value: untyped) -> ([Symbol] | [Symbol, Exception])
|
101
110
|
def return_type: () -> RBS::Types::t
|
102
111
|
end
|
103
112
|
|
@@ -106,8 +115,9 @@ module RaaP
|
|
106
115
|
@fun_type: FunctionType
|
107
116
|
|
108
117
|
def initialize: (::RBS::MethodType | String method, ?type_params_decl: Array[untyped], ?type_args: Array[untyped], ?self_type: ::RBS::Types::ClassInstance?, ?instance_type: ::RBS::Types::ClassInstance?, ?class_type: ::RBS::Types::ClassSingleton?) -> void
|
109
|
-
def pick_arguments: (?size: Integer
|
110
|
-
def
|
118
|
+
def pick_arguments: (?size: Integer) -> [Array[untyped], Hash[Symbol, untyped], ::Proc?]
|
119
|
+
def arguments_to_symbolic_call: (?size: Integer) -> [Array[untyped], Hash[Symbol, untyped], ::Proc?]
|
120
|
+
def pick_block: (?size: Integer) -> ::Proc?
|
111
121
|
def check_return: (untyped) -> bool
|
112
122
|
end
|
113
123
|
|
@@ -123,28 +133,37 @@ module RaaP
|
|
123
133
|
def self.env: () -> ::RBS::Environment
|
124
134
|
def self.loader: () -> ::RBS::EnvironmentLoader
|
125
135
|
def self.parse_type: (String) -> ::RBS::Types::t
|
136
|
+
def self.parse_method_type: (String) -> ::RBS::MethodType
|
137
|
+
def self.find_alias_decl: (::RBS::TypeName, Symbol) -> ::RBS::AST::Members::Alias?
|
126
138
|
end
|
127
139
|
|
128
140
|
module Result
|
129
|
-
interface
|
130
|
-
def symbolic_call: () -> symbolic_call
|
141
|
+
interface _ReturnValue
|
131
142
|
def return_value: () -> untyped
|
132
143
|
end
|
133
|
-
|
134
|
-
|
144
|
+
|
145
|
+
module ReturnValueWithType : _ReturnValue
|
146
|
+
def return_value_with_type: () -> String
|
147
|
+
|
148
|
+
private
|
149
|
+
|
150
|
+
def return_value_to_type: (untyped) -> String
|
135
151
|
end
|
152
|
+
|
136
153
|
class Success < Data
|
154
|
+
include ReturnValueWithType
|
137
155
|
def self.new: (symbolic_call: symbolic_call, return_value: untyped) -> instance
|
138
156
|
attr_reader symbolic_call: symbolic_call
|
139
157
|
attr_reader return_value: untyped
|
140
|
-
|
158
|
+
def called_str: () -> String
|
141
159
|
end
|
142
160
|
class Failure < Data
|
161
|
+
include ReturnValueWithType
|
143
162
|
def self.new: (symbolic_call: symbolic_call, return_value: untyped, ?exception: ::Exception?) -> instance
|
144
163
|
attr_reader symbolic_call: symbolic_call
|
145
164
|
attr_reader return_value: untyped
|
146
165
|
attr_reader exception: ::Exception?
|
147
|
-
|
166
|
+
def called_str: () -> String
|
148
167
|
end
|
149
168
|
class Skip < Data
|
150
169
|
def self.new: (symbolic_call: symbolic_call?, exception: ::Exception) -> instance
|
@@ -188,7 +207,7 @@ module RaaP
|
|
188
207
|
|
189
208
|
def try_eval: (untyped) -> untyped
|
190
209
|
def walk: () ?{ (symbolic_call) -> untyped} -> untyped
|
191
|
-
def _walk: (untyped) ?{ (symbolic_call) -> untyped} -> untyped
|
210
|
+
def _walk: (untyped, bool is_last) ?{ (symbolic_call) -> untyped} -> untyped
|
192
211
|
def eval_one: (symbolic_call) -> untyped
|
193
212
|
def var_name: (Module) -> String
|
194
213
|
def printable?: (untyped) -> bool
|
@@ -201,7 +220,7 @@ module RaaP
|
|
201
220
|
|
202
221
|
def initialize: (::Array[::RBS::AST::TypeParam], ::Array[::RBS::Types::t]) -> void
|
203
222
|
def build: () -> ::RBS::Substitution
|
204
|
-
def method_type_sub: (::RBS::MethodType, ?self_type: ::RBS::Types::
|
223
|
+
def method_type_sub: (::RBS::MethodType, ?self_type: ::RBS::Types::t?, ?instance_type: ::RBS::Types::ClassInstance?, ?class_type: ::RBS::Types::ClassSingleton?) -> ::RBS::MethodType
|
205
224
|
|
206
225
|
private
|
207
226
|
|
@@ -209,7 +228,7 @@ module RaaP
|
|
209
228
|
def map_type: { (untyped) -> untyped } -> untyped
|
210
229
|
end
|
211
230
|
|
212
|
-
def sub: (_MapType search, self_type: ::RBS::Types::
|
231
|
+
def sub: (_MapType search, self_type: ::RBS::Types::t?, instance_type: ::RBS::Types::t?, class_type: ::RBS::Types::t?) -> untyped
|
213
232
|
end
|
214
233
|
|
215
234
|
class Type
|
@@ -222,9 +241,12 @@ module RaaP
|
|
222
241
|
|
223
242
|
GENERATORS: Hash[String, ^() -> Sized[untyped]]
|
224
243
|
SIMPLE_SOURCE: Array[String]
|
225
|
-
RECURSION: Hash[String, :found | :logged]
|
226
244
|
|
227
245
|
def self.register: (String) { () [self: instance] -> Sized[untyped] } -> void
|
246
|
+
def self.random: () -> Type
|
247
|
+
def self.random_without_basic_object: () -> Type
|
248
|
+
def self.call_new_from: (Module, ::RBS::Types::ClassInstance, size: Integer) -> symbolic_call
|
249
|
+
|
228
250
|
attr_reader type: ::RBS::Types::t
|
229
251
|
attr_reader range: Range[untyped]
|
230
252
|
|
@@ -235,13 +257,14 @@ module RaaP
|
|
235
257
|
def such_that: () { (untyped) -> boolish } -> self
|
236
258
|
|
237
259
|
# Basic API for materializing values
|
238
|
-
def pick: (?size: Integer
|
260
|
+
def pick: (?size: Integer) -> untyped
|
261
|
+
def to_symbolic_caller: (?size: Integer) -> SymbolicCaller
|
239
262
|
def to_symbolic_call: (?size: Integer) -> untyped
|
240
263
|
def sized: [T] () { (Integer size) -> T } -> Sized[T]
|
241
264
|
|
242
265
|
private
|
243
266
|
|
244
|
-
def
|
267
|
+
def to_symbolic_call_from_initialize: (::RBS::Types::ClassInstance, size: Integer) -> (symbolic_call | Value::Module)
|
245
268
|
def parse: (String | ::RBS::Types::t) -> ::RBS::Types::t?
|
246
269
|
def try: (times: Integer, size: Integer) { (Integer size) -> untyped } -> untyped
|
247
270
|
|
@@ -254,9 +277,9 @@ module RaaP
|
|
254
277
|
def string: () -> Sized[String]
|
255
278
|
def symbol: () -> Sized[Symbol]
|
256
279
|
def array: (Type) -> Sized[Array[untyped]]
|
280
|
+
def dict: (Type, Type) -> Sized[Hash[untyped, untyped]]
|
257
281
|
def encoding: () -> Sized[symbolic_call]
|
258
282
|
def bool: () -> Sized[bool]
|
259
|
-
def untyped: () -> Sized[untyped]
|
260
283
|
def temp_method_object: () -> ::Method
|
261
284
|
end
|
262
285
|
|
@@ -271,7 +294,9 @@ module RaaP
|
|
271
294
|
@size: Integer
|
272
295
|
@definition: ::RBS::Definition
|
273
296
|
|
274
|
-
def
|
297
|
+
def self.define_method_from_interface: (Class base_class, String | ::RBS::Types::Interface type, ?size: Integer) -> void
|
298
|
+
def initialize: (String | ::RBS::Types::Interface | String, ?size: Integer) -> void
|
299
|
+
def respond_to?: (Symbol, ?boolish) -> bool
|
275
300
|
def inspect: () -> String
|
276
301
|
def class: () -> class
|
277
302
|
end
|
@@ -281,15 +306,19 @@ module RaaP
|
|
281
306
|
@children: Array[Type]
|
282
307
|
@size: Integer
|
283
308
|
|
284
|
-
def initialize: (::RBS::Types::Intersection, size: Integer) -> void
|
309
|
+
def initialize: (::RBS::Types::Intersection | String, ?size: Integer) -> void
|
310
|
+
def respond_to?: (Symbol, ?boolish) -> bool
|
285
311
|
def inspect: () -> String
|
286
312
|
def class: () -> class
|
287
313
|
end
|
288
314
|
|
289
|
-
class Module
|
290
|
-
|
315
|
+
class Module < BasicObject
|
316
|
+
@type: ::RBS::Types::ClassInstance
|
317
|
+
@size: Integer
|
318
|
+
@self_type: untyped
|
291
319
|
|
292
|
-
def initialize: (::RBS::Types::ClassInstance) -> void
|
320
|
+
def initialize: (::RBS::Types::ClassInstance | String, ?size: Integer) -> void
|
321
|
+
def respond_to?: (Symbol, ?boolish) -> bool
|
293
322
|
def inspect: () -> String
|
294
323
|
def class: () -> class
|
295
324
|
end
|
@@ -302,7 +331,7 @@ module RaaP
|
|
302
331
|
class Variable < BasicObject
|
303
332
|
attr_reader type: ::RBS::Types::Variable
|
304
333
|
|
305
|
-
def initialize: (::RBS::Types::Variable) -> void
|
334
|
+
def initialize: (::RBS::Types::Variable | String | Symbol) -> void
|
306
335
|
def inspect: () -> String
|
307
336
|
def class: () -> class
|
308
337
|
end
|
data/sig/shims.rbs
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbs
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: timeout
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '0.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '0.4'
|
41
41
|
description: Property based testing tool with RBS
|
42
42
|
email:
|
43
43
|
- co000ri@gmail.com
|
@@ -46,6 +46,7 @@ executables:
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
+
- ".rubocop.yml"
|
49
50
|
- CHANGELOG.md
|
50
51
|
- CODE_OF_CONDUCT.md
|
51
52
|
- LICENSE.txt
|
@@ -75,16 +76,16 @@ files:
|
|
75
76
|
- lib/raap/value/variable.rb
|
76
77
|
- lib/raap/value/void.rb
|
77
78
|
- lib/raap/version.rb
|
79
|
+
- public/jacket.webp
|
78
80
|
- rbs_collection.lock.yaml
|
79
81
|
- rbs_collection.yaml
|
80
82
|
- sig/raap.rbs
|
83
|
+
- sig/shims.rbs
|
81
84
|
homepage: https://github.com/ksss/raap
|
82
85
|
licenses:
|
83
86
|
- MIT
|
84
87
|
metadata:
|
85
|
-
|
86
|
-
source_code_uri: https://github.com/ksss/raap
|
87
|
-
changelog_uri: https://github.com/ksss/raap
|
88
|
+
rubygems_mfa_required: 'true'
|
88
89
|
post_install_message:
|
89
90
|
rdoc_options: []
|
90
91
|
require_paths:
|