sorbet-runtime 0.5.5657 → 0.5.5666

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: 04dbb8ac655032897af8b72e52e41e60bbb08d471e1bb3257422b0f765eca12e
4
- data.tar.gz: 7e661cde9f4fefc762c72875b320c54da69971f96a0906137ed1c398aea4c9bd
3
+ metadata.gz: b4cd866af0077ef936f1b120988e8477c5d92e616306940c12d90b0980f74d03
4
+ data.tar.gz: d168a8ea316b20032efbb2ee4bf532ca2fe45fac306866034286b6bf7e6ba4e3
5
5
  SHA512:
6
- metadata.gz: 4c7c50b7f66658e4e427629bcc881ddb9c7cf987c00b4a06e91c871c7e4105354811a4f6c40d72649a605b178ed8b7896f539f7329c30e6860ef8378964ce48b
7
- data.tar.gz: 07d5d1764063df2a278a0eb16363756cf33d12afb19ea10727a77600787238b3219661b1c0113d4b3a90f970c245da3953df21254b2eccd494f3da2f8c8390f7
6
+ metadata.gz: e7227a31f99a1bb1577bd65fac2a1a0ddf201d73428ed0cf4a2d9591d02732b2a38bcd122fc4f129dd1d030beb9b1adc8be023bf8b67a3260e9d748288ff1928
7
+ data.tar.gz: 0e7a3b52123add51b61a59f28f5ffb7cc6b2b70e1e38d70a0a22389d14051c6f118ba4b35b06f218e970c9c40a36529f6eeb15a2a7f2d07648996ad7a54c76cf
@@ -4,7 +4,8 @@
4
4
  require_relative 'private/methods/_methods'
5
5
 
6
6
  # Work around an interaction bug with sorbet-runtime and rspec-mocks,
7
- # which occurs when using *_any_instance_of and and_call_original.
7
+ # which occurs when using message expectations (*_any_instance_of,
8
+ # expect, allow) and and_call_original.
8
9
  #
9
10
  # When a sig is defined, sorbet-runtime will replace the sigged method
10
11
  # with a wrapper that, upon first invocation, re-wraps the method with a faster
@@ -22,17 +23,30 @@ require_relative 'private/methods/_methods'
22
23
  #
23
24
  # We work around this by forcing re-wrapping before rspec stores a reference
24
25
  # to the method.
25
- if defined? ::RSpec::Mocks::AnyInstance
26
+ if defined? ::RSpec::Mocks
26
27
  module T
27
28
  module CompatibilityPatches
28
- module RecorderExtensions
29
- def observe!(method_name)
30
- method = @klass.instance_method(method_name.to_sym)
31
- T::Private::Methods.maybe_run_sig_block_for_method(method)
32
- super(method_name)
29
+ module RSpecCompatibility
30
+ module RecorderExtensions
31
+ def observe!(method_name)
32
+ method = @klass.instance_method(method_name.to_sym)
33
+ T::Private::Methods.maybe_run_sig_block_for_method(method)
34
+ super(method_name)
35
+ end
33
36
  end
37
+ ::RSpec::Mocks::AnyInstance::Recorder.prepend(RecorderExtensions) if defined?(::RSpec::Mocks::AnyInstance::Recorder)
38
+
39
+ module MethodDoubleExtensions
40
+ def initialize(object, method_name, proxy)
41
+ if ::Kernel.instance_method(:respond_to?).bind(object).call(method_name, true)
42
+ method = ::RSpec::Support.method_handle_for(object, method_name)
43
+ T::Private::Methods.maybe_run_sig_block_for_method(method)
44
+ end
45
+ super(object, method_name, proxy)
46
+ end
47
+ end
48
+ ::RSpec::Mocks::MethodDouble.prepend(MethodDoubleExtensions) if defined?(::RSpec::Mocks::MethodDouble)
34
49
  end
35
- ::RSpec::Mocks::AnyInstance::Recorder.prepend(RecorderExtensions)
36
50
  end
37
51
  end
38
52
  end
@@ -66,7 +66,6 @@ class T::Props::Decorator
66
66
  without_accessors
67
67
  clobber_existing_method!
68
68
  extra
69
- optional
70
69
  setter_validate
71
70
  _tnilable
72
71
  }.map {|k| [k, true]}.to_h.freeze, T::Hash[Symbol, T::Boolean])
@@ -289,47 +288,6 @@ class T::Props::Decorator
289
288
  end
290
289
  def prop_defined(name, cls, rules={})
291
290
  cls = T::Utils.resolve_alias(cls)
292
- if rules[:optional] == true
293
- T::Configuration.hard_assert_handler(
294
- 'Use of `optional: true` is deprecated, please use `T.nilable(...)` instead.',
295
- storytime: {
296
- name: name,
297
- cls_or_args: cls.to_s,
298
- args: rules,
299
- klass: decorated_class.name,
300
- },
301
- )
302
- elsif rules[:optional] == false
303
- T::Configuration.hard_assert_handler(
304
- 'Use of `optional: :false` is deprecated as it\'s the default value.',
305
- storytime: {
306
- name: name,
307
- cls_or_args: cls.to_s,
308
- args: rules,
309
- klass: decorated_class.name,
310
- },
311
- )
312
- elsif rules[:optional] == :on_load
313
- T::Configuration.hard_assert_handler(
314
- 'Use of `optional: :on_load` is deprecated. You probably want `T.nilable(...)` with :raise_on_nil_write instead.',
315
- storytime: {
316
- name: name,
317
- cls_or_args: cls.to_s,
318
- args: rules,
319
- klass: decorated_class.name,
320
- },
321
- )
322
- elsif rules[:optional] == :existing
323
- T::Configuration.hard_assert_handler(
324
- 'Use of `optional: :existing` is not allowed: you should use use T.nilable (http://go/optional)',
325
- storytime: {
326
- name: name,
327
- cls_or_args: cls.to_s,
328
- args: rules,
329
- klass: decorated_class.name,
330
- },
331
- )
332
- end
333
291
 
334
292
  if T::Utils::Nilable.is_union_with_nilclass(cls)
335
293
  # :_tnilable is introduced internally for performance purpose so that clients do not need to call
@@ -14,19 +14,9 @@ end
14
14
  module T::Props::Optional::DecoratorMethods
15
15
  extend T::Sig
16
16
 
17
- # TODO: clean this up. This set of options is confusing, and some of them are not universally
18
- # applicable (e.g., :on_load only applies when using T::Serializable).
19
- VALID_OPTIONAL_RULES = Set[
20
- :existing, # deprecated
21
- :on_load,
22
- false,
23
- true,
24
- ].freeze
25
-
26
17
  VALID_RULE_KEYS = {
27
18
  default: true,
28
19
  factory: true,
29
- optional: true,
30
20
  }.freeze
31
21
  private_constant :VALID_RULE_KEYS
32
22
 
@@ -74,12 +64,6 @@ module T::Props::Optional::DecoratorMethods
74
64
  def prop_validate_definition!(name, cls, rules, type)
75
65
  result = super
76
66
 
77
- if (rules_optional = rules[:optional])
78
- if !VALID_OPTIONAL_RULES.include?(rules_optional)
79
- raise ArgumentError.new(":optional must be one of #{VALID_OPTIONAL_RULES.inspect}")
80
- end
81
- end
82
-
83
67
  if rules.key?(:default) && rules.key?(:factory)
84
68
  raise ArgumentError.new("Setting both :default and :factory is invalid. See: go/chalk-docs")
85
69
  end
@@ -26,7 +26,7 @@ module T::Props
26
26
 
27
27
  sig do
28
28
  params(
29
- type: T.any(T::Types::Base, Module),
29
+ type: T::Types::Base,
30
30
  mode: ModeType,
31
31
  varname: String,
32
32
  )
@@ -134,12 +134,7 @@ module T::Props
134
134
  when T::Types::Enum
135
135
  generate(T::Utils.lift_enum(type), mode, varname)
136
136
  else
137
- if type.singleton_class < T::Props::CustomType
138
- # Sometimes this comes wrapped in a T::Types::Simple and sometimes not
139
- handle_custom_type(varname, T.unsafe(type), mode)
140
- else
141
- "T::Props::Utils.deep_clone_object(#{varname})"
142
- end
137
+ "T::Props::Utils.deep_clone_object(#{varname})"
143
138
  end
144
139
  end
145
140
 
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.5657
4
+ version: 0.5.5666
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-20 00:00:00.000000000 Z
11
+ date: 2020-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest