sorbet-runtime 0.5.5435 → 0.5.5439
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/types/compatibility_patches.rb +43 -0
- data/lib/types/props/decorator.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15b884405afe5ef1a9261206433553142c10166302d6bcc80e9ffed82343ac4c
|
4
|
+
data.tar.gz: 2c5a550e1d9b9363cacefc36ce53fa86a3b36bde40f6f018e8bfad4632130a5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0038a4dd9590fd6c8cdd30c41eea8767f2ad6c30e779979e8d4b880132c8d352343d0a46ef1ef1852edcadc157b28b09e498d356721d518734817e0759958aa1'
|
7
|
+
data.tar.gz: c6e0dad262a7105db18b126d8fc01168ec3a3a7c5f6982f1753368561d77540b40384f7cfaed50e38e94767ff136a306c22d377b0c6db6ee965cd3d44f14a793
|
@@ -36,3 +36,46 @@ if defined? ::RSpec::Mocks::AnyInstance
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
# Work around for sorbet-runtime wrapped methods.
|
41
|
+
#
|
42
|
+
# When a sig is defined, sorbet-runtime will replace the sigged method
|
43
|
+
# with a wrapper. Those wrapper methods look like `foo(*args, &blk)`
|
44
|
+
# so that wrappers can handle and pass on all the arguments supplied.
|
45
|
+
#
|
46
|
+
# However, that creates a problem with runtime reflection on the methods,
|
47
|
+
# since when a sigged method is introspected, it will always return its
|
48
|
+
# `arity` as `-1`, its `parameters` as `[[:rest, :args], [:block, :blk]]`,
|
49
|
+
# and its `source_location` as `[<some_file_in_sorbet>, <some_line_number>]`.
|
50
|
+
#
|
51
|
+
# This might be a problem for some applications that rely on getting the
|
52
|
+
# correct information from these methods.
|
53
|
+
#
|
54
|
+
# This compatibility module, when prepended to the `Method` class, would fix
|
55
|
+
# the return values of `arity`, `parameters` and `source_location`.
|
56
|
+
#
|
57
|
+
# @example
|
58
|
+
# require 'sorbet-runtime'
|
59
|
+
# ::Method.prepend(T::CompatibilityPatches::MethodExtensions)
|
60
|
+
module T
|
61
|
+
module CompatibilityPatches
|
62
|
+
module MethodExtensions
|
63
|
+
def arity
|
64
|
+
arity = super
|
65
|
+
return arity if arity != -1 || self.is_a?(Proc)
|
66
|
+
sig = T::Private::Methods.signature_for_method(self)
|
67
|
+
sig ? sig.method.arity : arity
|
68
|
+
end
|
69
|
+
|
70
|
+
def source_location
|
71
|
+
sig = T::Private::Methods.signature_for_method(self)
|
72
|
+
sig ? sig.method.source_location : super
|
73
|
+
end
|
74
|
+
|
75
|
+
def parameters
|
76
|
+
sig = T::Private::Methods.signature_for_method(self)
|
77
|
+
sig ? sig.method.parameters : super
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorbet-runtime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5439
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|