raap 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/raap/coverage.rb +2 -1
- data/lib/raap/function_type.rb +1 -1
- data/lib/raap/method_type.rb +2 -2
- data/lib/raap/symbolic_caller.rb +2 -2
- data/lib/raap/value/interface.rb +4 -4
- data/lib/raap/value/intersection.rb +1 -1
- data/lib/raap/value/variable.rb +1 -0
- data/lib/raap/version.rb +1 -1
- data/lib/shims.rb +19 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11be72cf2761c092ecbbcb59c5fd6d63de28d5c469b08595788cd62d27ba65c3
|
4
|
+
data.tar.gz: 2dc754b684cca3752177f0a5d1ef12ae3126d6ae7b32e07664e639fa27037f8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dcca8c7c5aa10b0cd611a60c38a84bf4db1915cd049d701f068836488b748b653bd0a811d606c943754c0b4e72367d8e9255c06cdf0ab0f398bd3da3ce5357e
|
7
|
+
data.tar.gz: 3f2e7d3947ed5fbc02496b0f5437d100d6e6ba9cf8fd60c28b522d49f867c955b72a287d1845186346a377047acfed7d9944e6ef80d0dec1491235c3da9bf203
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
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
|
+
|
3
7
|
## [0.10.0] - 2024-06-25
|
4
8
|
|
5
9
|
* Support default nil in block by @ksss in https://github.com/ksss/raap/pull/18
|
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
|
-
|
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 [
|
data/lib/raap/function_type.rb
CHANGED
data/lib/raap/method_type.rb
CHANGED
@@ -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
|
data/lib/raap/symbolic_caller.rb
CHANGED
@@ -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)
|
data/lib/raap/value/interface.rb
CHANGED
@@ -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
|
data/lib/raap/value/variable.rb
CHANGED
data/lib/raap/version.rb
CHANGED
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: 1.
|
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:
|
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.
|
98
|
+
rubygems_version: 3.5.22
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: RBS as a Property
|