sorbet-runtime 0.5.5579 → 0.5.5585

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: 64118c41b03c7b4d993275e0ff71f853fa8ffa2078fbaf769ca6755564fb0ef8
4
- data.tar.gz: ae794f0928f3b8fbf95e154afccb21b3fc206a3c096eb9b9bdaa159638fe6599
3
+ metadata.gz: 35b3fe4f8f7fae4fdbd19e655762c071f4f37f928904605e99041b66019b2a9a
4
+ data.tar.gz: c1468cf54f40df012dd952b783f4c8acfeb13c7740088563f9167bdc057929bc
5
5
  SHA512:
6
- metadata.gz: 27ebb20c813c95d0d3b4e354d72f4cae80297050fbf3697fd9fa9512fed0c9cc04f9fc7a315e25aad267c222fc2e0fc05bb2e2436877d0e0b8ad97ebe87a5a18
7
- data.tar.gz: c0b048e1a48b5481ad65b81d1a0cdeeab956b4aa3edf61f2e7381cfc077996ce459899cc680ac1948fe68a4e892c05f8b9c7510ac3412f4cb3f9db623ef131e7
6
+ metadata.gz: 90dd82b326e2334f0aed1bb8b501e84d286e015888baac656020dd882446b40a49ab45de1f7d6dd01cd3fe89015b5702d5e9e40c7ef0e8ca4d0ef05acb386a25
7
+ data.tar.gz: 8d4d4916ac9a8b16223143e091289876f5b81816817f72e7eb7eb66ee594ca6f137495e2460ef25230a751ecb99d6831c38b8093fd371cccfa5154a7c769bd56
@@ -110,5 +110,6 @@ require_relative 'types/props/private/parser'
110
110
  require_relative 'types/props/generated_code_validation'
111
111
 
112
112
  require_relative 'types/struct'
113
+ require_relative 'types/non_forcing_constants'
113
114
 
114
115
  require_relative 'types/compatibility_patches'
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ module T::NonForcingConstants
5
+ # NOTE: This method is documented on the RBI in Sorbet's payload, so that it
6
+ # shows up in the hover/completion documentation via LSP.
7
+ T::Sig::WithoutRuntime.sig {params(val: BasicObject, klass: String).returns(T::Boolean)}
8
+ def self.non_forcing_is_a?(val, klass)
9
+ method_name = "T::NonForcingConstants.non_forcing_is_a?"
10
+ if klass.empty?
11
+ raise ArgumentError.new("The string given to `#{method_name}` must not be empty")
12
+ end
13
+
14
+ current_klass = T.let(nil, T.nilable(Module))
15
+ current_prefix = T.let(nil, T.nilable(String))
16
+
17
+ parts = klass.split('::')
18
+ parts.each do |part|
19
+ if current_klass.nil?
20
+ # First iteration
21
+ if part != ""
22
+ raise ArgumentError.new("The string given to `#{method_name}` must be an absolute constant reference that starts with `::`")
23
+ end
24
+
25
+ current_klass = Object
26
+ current_prefix = ''
27
+ else
28
+ if current_klass.autoload?(part)
29
+ # There's an autoload registered for that constant, which means it's not
30
+ # yet loaded. `value` can't be an instance of something not yet loaded.
31
+ return false
32
+ end
33
+
34
+ # Sorbet guarantees that the string is an absolutely resolved name.
35
+ search_inheritance_chain = false
36
+ if !current_klass.const_defined?(part, search_inheritance_chain)
37
+ return false
38
+ end
39
+
40
+ current_klass = current_klass.const_get(part)
41
+ current_prefix = "#{current_prefix}::#{part}"
42
+
43
+ if !Module.===(current_klass)
44
+ raise ArgumentError.new("#{current_prefix} is not a class or module")
45
+ end
46
+ end
47
+ end
48
+
49
+ return current_klass.===(val)
50
+ end
51
+ end
@@ -605,14 +605,6 @@ class T::Props::Decorator
605
605
  end
606
606
  loaded_foreign
607
607
  end
608
-
609
- @class.send(:define_method, "#{prop_name}_record") do |allow_direct_mutation: nil|
610
- T::Configuration.soft_assert_handler(
611
- "Using deprecated 'model.#{prop_name}_record' foreign key syntax. You should replace this with 'model.#{prop_name}_'",
612
- notify: 'vasi'
613
- )
614
- send(fk_method, allow_direct_mutation: allow_direct_mutation)
615
- end
616
608
  end
617
609
 
618
610
  # checked(:never) - Rules hash is expensive to check
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.5579
4
+ version: 0.5.5585
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-05 00:00:00.000000000 Z
11
+ date: 2020-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -124,6 +124,7 @@ files:
124
124
  - lib/types/generic.rb
125
125
  - lib/types/helpers.rb
126
126
  - lib/types/interface_wrapper.rb
127
+ - lib/types/non_forcing_constants.rb
127
128
  - lib/types/private/abstract/data.rb
128
129
  - lib/types/private/abstract/declare.rb
129
130
  - lib/types/private/abstract/hooks.rb