raap 0.10.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b326e4d67e7475c2b0c20dd3327c92d50d5c1adda8c45adc05e6ba58b3e289c0
4
- data.tar.gz: e6f3d8ed34403ba7561fb2864c5e1410eaf07da10917eb43122d0dd373817e82
3
+ metadata.gz: 11be72cf2761c092ecbbcb59c5fd6d63de28d5c469b08595788cd62d27ba65c3
4
+ data.tar.gz: 2dc754b684cca3752177f0a5d1ef12ae3126d6ae7b32e07664e639fa27037f8a
5
5
  SHA512:
6
- metadata.gz: '094fe3ad8922e1c86fdfcf67353c0819b501637f99235fd2eebc8470196d41b5f89b3c8aaea9a48681c122dd434b11ebc349b733f47637cbaf706748ee613373'
7
- data.tar.gz: d1dcf25d8cd69d7f48c6095fb3f9c8e1f144704fc12a5a441e231d371c4b8d62b76c75a6e9b09ab1375fc45071361a9988ee268c7c4dfa7e0828de6f5137246b
6
+ metadata.gz: 8dcca8c7c5aa10b0cd611a60c38a84bf4db1915cd049d701f068836488b748b653bd0a811d606c943754c0b4e72367d8e9255c06cdf0ab0f398bd3da3ce5357e
7
+ data.tar.gz: 3f2e7d3947ed5fbc02496b0f5437d100d6e6ba9cf8fd60c28b522d49f867c955b72a287d1845186346a377047acfed7d9944e6ef80d0dec1491235c3da9bf203
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.0.0] - 2024-08-23
4
+
5
+ * Do not modify array for RBS::Types::ClassInstance#args by @pocke in https://github.com/ksss/raap/pull/25
6
+
7
+ ## [0.10.0] - 2024-06-25
8
+
9
+ * Support default nil in block by @ksss in https://github.com/ksss/raap/pull/18
10
+ * Support Enumerator by @ksss in https://github.com/ksss/raap/pull/19
11
+ * Support BigDecimal by @ksss in https://github.com/ksss/raap/pull/20
12
+
3
13
  ## [0.9.0] - 2024-06-11
4
14
 
5
15
  * Update ruby by @ksss in https://github.com/ksss/raap/pull/15
data/lib/raap/cli.rb CHANGED
@@ -274,10 +274,12 @@ module RaaP
274
274
  end
275
275
 
276
276
  # type_args delegate to self_type
277
- type_params_decl.each_with_index do |param, i|
278
- if rtype.instance_of?(::RBS::Types::ClassInstance)
279
- rtype.args[i] = type_args[i] || param.upper_bound || ::RBS::Types::Bases::Any.new(location: nil)
277
+ if rtype.instance_of?(::RBS::Types::ClassInstance)
278
+ args = type_params_decl.map.with_index do |param, i|
279
+ type_args[i] || param.upper_bound || ::RBS::Types::Bases::Any.new(location: nil)
280
280
  end
281
+ rtype = ::RBS::Types::ClassInstance.new(name: rtype.name, args: args, location: rtype.location)
282
+ receiver_type = Type.new(rtype)
281
283
  end
282
284
  RaaP.logger.info("## def #{prefix}#{method_name}: #{method_type}")
283
285
  status = 0
@@ -305,7 +307,7 @@ module RaaP
305
307
  print '.'
306
308
  RaaP.logger.debug { "Success: #{s.called_str}" }
307
309
  in Result::Failure => f
308
- puts 'F'
310
+ print 'F'
309
311
  if (e = f.exception)
310
312
  RaaP.logger.info { "Failure: [#{e.class}] #{e.message}" }
311
313
  RaaP.logger.debug { e.backtrace.join("\n") }
@@ -336,12 +338,12 @@ module RaaP
336
338
  end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
337
339
  puts
338
340
  RaaP::Coverage.show($stdout) if @option.coverage
339
- puts
340
341
 
341
342
  time_diff = end_time - start_time
342
343
  time = ", time: #{(time_diff * 1000).round}ms"
343
344
  stats_log = "success: #{stats.success}, skip: #{stats.skip}, exception: #{stats.exception}#{time}"
344
345
  RaaP.logger.info(stats_log)
346
+ puts
345
347
 
346
348
  if status == 0 && stats.success.zero? && !stats.break
347
349
  status = 1
data/lib/raap/coverage.rb CHANGED
@@ -83,7 +83,8 @@ module RaaP
83
83
  @cur = type.location.start_pos
84
84
  case type
85
85
  when ::RBS::Types::Tuple, ::RBS::Types::Union
86
- name = type.class.name.split('::').last.downcase
86
+ cname = type.class.name or raise
87
+ name = cname.split('::').last.downcase
87
88
  type.types.each_with_index do |t, i|
88
89
  t.location or raise
89
90
  io.write(slice(@cur, @cur...t.location.start_pos)) # ( or [
@@ -43,7 +43,7 @@ module RaaP
43
43
  build_type_with_coverage("opt_#{i}", param)
44
44
  end
45
45
 
46
- rest = []
46
+ rest = [] #: Array[untyped]
47
47
  if (rest_param = @fun.rest_positionals)
48
48
  rest = Array.new(Random.rand(4)) do
49
49
  build_type_with_coverage("rest", rest_param)
@@ -48,8 +48,8 @@ module RaaP
48
48
  return nil if block.nil?
49
49
  return nil if (block.required == false) && [true, false].sample
50
50
 
51
- args_name = []
52
- args_source = []
51
+ args_name = [] #: Array[String]
52
+ args_source = [] #: Array[String]
53
53
  resource = [*'a'..'z']
54
54
  case fun = block.type
55
55
  when ::RBS::Types::Function
@@ -51,7 +51,7 @@ module RaaP
51
51
  receiver = try_eval(receiver)
52
52
  args, kwargs, block = try_eval([args, kwargs, block])
53
53
 
54
- a = []
54
+ a = [] #: Array[String]
55
55
  a << args.map(&BindCall.method(:inspect)).join(', ') if !args.empty?
56
56
  a << kwargs.map { |k, v| "#{k}: #{BindCall.inspect(v)}" }.join(', ') if !kwargs.empty?
57
57
  argument_str = a.join(', ')
@@ -87,7 +87,7 @@ module RaaP
87
87
 
88
88
  var_eq = '' if is_last
89
89
 
90
- arguments = []
90
+ arguments = [] #: Array[Array[String]]
91
91
  if !args.empty?
92
92
  # The reproduction code is kept short and executable.
93
93
  if [Value::Interface, Value::Intersection].include?(receiver_value)
@@ -12,8 +12,8 @@ module RaaP
12
12
  self_type = type
13
13
 
14
14
  # Referring to Steep
15
- instance_type = ::RBS::Types::ClassInstance.new(name: TypeName("::Object"), args: [], location: nil)
16
- class_type = ::RBS::Types::ClassSingleton.new(name: TypeName("::Object"), location: nil)
15
+ instance_type = ::RBS::Types::ClassInstance.new(name: ::RBS::TypeName.parse("::Object"), args: [], location: nil)
16
+ class_type = ::RBS::Types::ClassSingleton.new(name: ::RBS::TypeName.parse("::Object"), location: nil)
17
17
 
18
18
  definition = RBS.builder.build_interface(type.name.absolute!)
19
19
  definition.methods.each do |name, method|
@@ -23,7 +23,7 @@ module RaaP
23
23
  subed_method_type = ts.method_type_sub(method_type, self_type: self_type, instance_type: instance_type, class_type: class_type)
24
24
 
25
25
  BindCall.define_method(base_mod, name) do |*_, &b|
26
- @fixed_return_value ||= {}
26
+ @fixed_return_value ||= {} #: Hash[Symbol, Interface | Type]
27
27
  @fixed_return_value[name] ||= if self_type == subed_method_type.type.return_type
28
28
  self
29
29
  else
@@ -31,7 +31,7 @@ module RaaP
31
31
  end
32
32
  # @type var b: Proc?
33
33
  if b && subed_method_type.block && subed_method_type.block.type.is_a?(::RBS::Types::Function)
34
- @fixed_block_arguments ||= {}
34
+ @fixed_block_arguments ||= {} #: Hash[Symbol, Array[FunctionType]]
35
35
  @fixed_block_arguments[name] ||= size.times.map do
36
36
  FunctionType.new(subed_method_type.block.type, coverage: false)
37
37
  .pick_arguments(size: size)
@@ -31,7 +31,7 @@ module RaaP
31
31
  end
32
32
  end
33
33
  end
34
- type = ::RBS::Types::ClassInstance.new(name: TypeName(base.name), args: [], location: nil)
34
+ type = ::RBS::Types::ClassInstance.new(name: ::RBS::TypeName.parse(base.name), args: [], location: nil)
35
35
  SymbolicCaller.new(Type.call_new_from(c, type, size: size)).eval
36
36
  end
37
37
  end
@@ -11,6 +11,7 @@ module RaaP
11
11
  # @type var type: String | Symbol
12
12
  ::RBS::Types::Variable.new(name: type.to_sym, location: nil)
13
13
  else
14
+ # @type var type: ::RBS::Types::Variable
14
15
  type
15
16
  end
16
17
  unless @type.instance_of?(::RBS::Types::Variable)
data/lib/raap/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RaaP
4
- VERSION = "0.10.0"
4
+ VERSION = "1.1.0"
5
5
  end
data/lib/shims.rb CHANGED
@@ -36,3 +36,22 @@ unless defined?(Data)
36
36
  end
37
37
  end
38
38
  end
39
+
40
+ # RBS 3.8
41
+ unless RBS::TypeName.singleton_class.method_defined?(:parse)
42
+ module RBS
43
+ class TypeName
44
+ def self.parse(string)
45
+ absolute = string.start_with?("::")
46
+
47
+ *path, name = string.delete_prefix("::").split("::").map(&:to_sym)
48
+ raise unless name
49
+
50
+ TypeName.new(
51
+ name: name,
52
+ namespace: RBS::Namespace.new(path: path, absolute: absolute)
53
+ )
54
+ end
55
+ end
56
+ end
57
+ end
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.10.0
4
+ version: 1.1.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-06-25 00:00:00.000000000 Z
11
+ date: 2025-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  requirements: []
98
- rubygems_version: 3.5.9
98
+ rubygems_version: 3.5.22
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: RBS as a Property