sorbet-runtime 0.4.4323 → 0.4.4324

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
  SHA1:
3
- metadata.gz: 2b10dea785d753f0579724c236f50c764d3e1b71
4
- data.tar.gz: be53840e8fab0350d7952d1d78d540ed7cb429f6
3
+ metadata.gz: 3a117936c3982c8ba0fa305ff6cdfc58c4570a63
4
+ data.tar.gz: 9871ba952fd1f97146f87f67784f6b01806beab0
5
5
  SHA512:
6
- metadata.gz: ca12c0724b564aba6218b243cc616f9ce62473ab680a3c2a852f084675ecc69acad2d7c7faee45a14de2d9162f722c09d829587f2b40838058f77116cffa1785
7
- data.tar.gz: 8ec7866f72f6794eab31029c74d6aae5ed5d94117af17879c036c045132345e6c0a3063416dd76f69a9b1d8d12f1c023e39677ffe8b7df64ad665f2650c6383a
6
+ metadata.gz: 30947911f3a2f17f1c15393e92b5312e4f160daea9aa9d036dd9ab9b3f0648f5824593b537be6520311b7a78fd64e41d969c0e5a0ec754bab18a1e9e24a903ee
7
+ data.tar.gz: 9bc0852dbd630a6ed3685c81d14ae77849afe4bb117a15b14d9b133dbd4085b2f3e6c9d43bcee6b636f9b68eb3b1da2bf93d1c9b0f5d750bc26c426b8835e607
data/lib/types/boolean.rb CHANGED
@@ -1,4 +1,4 @@
1
- # typed: true
1
+ # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module T
@@ -99,11 +99,10 @@ module T::Configuration
99
99
  # successfully built, but the built sig is incompatible with other sigs in
100
100
  # some way.
101
101
  #
102
- # By default, sig validation errors cause an exception to be raised. One
103
- # exception is for `generated` sigs, for which a message will be logged
104
- # instead of raising. Setting sig_validation_error_handler to an object that
105
- # implements :call (e.g. proc or lambda) allows users to customize the
106
- # behavior when a method signature's build fails.
102
+ # By default, sig validation errors cause an exception to be raised.
103
+ # Setting sig_validation_error_handler to an object that implements :call
104
+ # (e.g. proc or lambda) allows users to customize the behavior when a method
105
+ # signature's build fails.
107
106
  #
108
107
  # @param [Lambda, Proc, Object, nil] value Proc that handles the error (pass
109
108
  # nil to reset to default behavior)
@@ -131,24 +130,7 @@ module T::Configuration
131
130
  end
132
131
 
133
132
  private_class_method def self.sig_validation_error_handler_default(error, opts)
134
- # if this method overrides a generated signature, report that one instead
135
- bad_method = opts[:method]
136
- if !opts[:declaration].generated
137
- super_signature = opts[:super_signature]
138
- raise error if !super_signature&.generated
139
- bad_method = super_signature.method
140
- end
141
-
142
- method_file, method_line = bad_method.source_location
143
- T::Configuration.log_info_handler(
144
- "SIG-DECLARE-FAILED",
145
- {
146
- definition_file: method_file,
147
- definition_line: method_line,
148
- kind: "Delete",
149
- message: error.message,
150
- },
151
- )
133
+ raise error
152
134
  end
153
135
 
154
136
  def self.sig_validation_error_handler(error, opts)
@@ -162,11 +144,9 @@ module T::Configuration
162
144
  # Set a handler for type errors that result from calling a method.
163
145
  #
164
146
  # By default, errors from calling a method cause an exception to be raised.
165
- # One exception is for `generated` sigs, for which a message will be logged
166
- # instead of raising. Setting call_validation_error_handler to an object that
167
- # implements :call (e.g. proc or lambda) allows users to customize the
168
- # behavior when a method is called with invalid parameters, or returns an
169
- # invalid value.
147
+ # Setting call_validation_error_handler to an object that implements :call
148
+ # (e.g. proc or lambda) allows users to customize the behavior when a method
149
+ # is called with invalid parameters, or returns an invalid value.
170
150
  #
171
151
  # @param [Lambda, Proc, Object, nil] value Proc that handles the error
172
152
  # report (pass nil to reset to default behavior)
@@ -197,39 +177,12 @@ module T::Configuration
197
177
  private_class_method def self.call_validation_error_handler_default(signature, opts)
198
178
  method_file, method_line = signature.method.source_location
199
179
  location = opts[:location]
200
- suffix = "Caller: #{location.path}:#{location.lineno}\n" \
201
- "Definition: #{method_file}:#{method_line}"
202
180
 
203
- error_message = "#{opts[:kind]}#{opts[:name] ? " '#{opts[:name]}'" : ''}: #{opts[:message]}\n#{suffix}"
181
+ error_message = "#{opts[:kind]}#{opts[:name] ? " '#{opts[:name]}'" : ''}: #{opts[:message]}\n" \
182
+ "Caller: #{location.path}:#{location.lineno}\n" \
183
+ "Definition: #{method_file}:#{method_line}"
204
184
 
205
- if signature.generated
206
- got = opts[:value].class
207
- got = T.unsafe(T::Enumerable[T.untyped]).describe_obj(opts[:value]) if got < Enumerable
208
- T::Configuration.log_info_handler(
209
- "SIG-CHECK-FAILED",
210
- {
211
- caller_file: location.path,
212
- caller_line: location.lineno,
213
- definition_file: method_file,
214
- definition_line: method_line,
215
- kind: opts[:kind],
216
- name: opts[:name],
217
- expected: opts[:type].name,
218
- got: got,
219
- },
220
- )
221
- elsif signature.soft_notify
222
- T::Configuration.soft_assert_handler(
223
- "TypeError: #{error_message}",
224
- {notify: signature.soft_notify}
225
- )
226
- else
227
- begin
228
- raise TypeError.new(error_message)
229
- rescue TypeError => e # raise into rescue to ensure e.backtrace is populated
230
- T::Private::ErrorHandler.handle_inline_type_error(e)
231
- end
232
- end
185
+ raise TypeError.new(error_message)
233
186
  end
234
187
 
235
188
  def self.call_validation_error_handler(signature, opts)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # typed: true
2
+ # typed: strict
3
3
 
4
4
  module T::Props
5
5
  class Error < StandardError; end
@@ -1,4 +1,4 @@
1
- # typed: true
1
+ # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
4
  #
data/lib/types/sig.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # typed: true
2
+ # typed: strict
3
3
 
4
4
  # Used as a mixin to any class so that you can call `sig`.
5
5
  # Docs at https://sorbet.org/docs/sigs
@@ -11,7 +11,7 @@ module T::Sig
11
11
 
12
12
  # At runtime, does nothing, but statically it is treated exactly the same
13
13
  # as T::Sig#sig. Only use it in cases where you can't use T::Sig#sig.
14
- T::Sig::WithoutRuntime.sig {params(blk: T.proc.bind(T::Private::Methods::DeclBuilder).void).void} # rubocop:disable PrisonGuard/PrivateModule
14
+ T::Sig::WithoutRuntime.sig {params(blk: T.proc.bind(T::Private::Methods::DeclBuilder).void).void}
15
15
  def self.sig(&blk); end # rubocop:disable PrisonGuard/BanBuiltinMethodOverride, Lint/DuplicateMethods
16
16
  end
17
17
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # typed: true
2
+ # typed: strict
3
3
 
4
4
  module T::Types
5
5
  class TypeMember < TypeVariable
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # typed: true
2
+ # typed: strict
3
3
 
4
4
  module T::Types
5
5
  class TypeTemplate < TypeVariable
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorbet-runtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4323
4
+ version: 0.4.4324
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe