sorbet-runtime 0.5.5247 → 0.5.5255

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a75290811d1d0f0bdbbf02926c6970e7936fafd46aa26eec9ebe3655d4ddb513
4
- data.tar.gz: e31c36b34c8eb86613ee3b0d978fd9408ff3c85d958ecd6c6cb0a796c477455e
3
+ metadata.gz: 5001cde809170dd114c21f38d060d0ea4d0c7447bd719020a28d8219c733593b
4
+ data.tar.gz: 8af071522bf9cfcfd89eea4ca0567e06ad6109cfe2e827f00542a00e971eaa26
5
5
  SHA512:
6
- metadata.gz: aacc94f6d25fdcddbb0cc492c3bda050deb450a80a46f4e0e298b24fefc116e982b3c8f4b9f45e22f7405efe8c3da09e899029431441db88392e1d4612871305
7
- data.tar.gz: 0bb74ef090055f4c98d4e6086213e3b545a39467356a04605ccabaafa829f7cf70b2133806993546727e66f9498f21f0fc38fb501aed28cf976ae40f48348dca
6
+ metadata.gz: a7695bfaf0c47b193d1cccc99cb89159a7d29e2efbfb89c21c3dbbcd9c1ba4c5cb53ba12dbceb9589b2d51b6bc765854d45469931740a3c73f2c40517defa4c0
7
+ data.tar.gz: 812f4170808544d2d320fb834f28fcbdeba7d9ba26041b18cdece81aaae8feb1d924d7e942a60b4d305b5747867cd75abd6149da2be9ffc30ef966c3c89bb9f8
@@ -393,6 +393,33 @@ module T::Configuration
393
393
  @legacy_t_enum_migration_mode || false
394
394
  end
395
395
 
396
+ # @param [Array] sealed_violation_whitelist An array of Regexp to validate
397
+ # whether inheriting /including a sealed module outside the defining module
398
+ # should be allowed. Useful to whitelist benign violations, like shim files
399
+ # generated for an autoloader.
400
+ def self.sealed_violation_whitelist=(sealed_violation_whitelist)
401
+ if @sealed_violation_whitelist != nil
402
+ raise ArgumentError.new("Cannot overwrite sealed_violation_whitelist after setting it")
403
+ end
404
+
405
+ case sealed_violation_whitelist
406
+ when Array
407
+ sealed_violation_whitelist.each do |x|
408
+ case x
409
+ when Regexp then nil
410
+ else raise TypeError.new("sealed_violation_whitelist accepts an Array of Regexp")
411
+ end
412
+ end
413
+ else
414
+ raise TypeError.new("sealed_violation_whitelist= accepts an Array of Regexp")
415
+ end
416
+
417
+ @sealed_violation_whitelist = sealed_violation_whitelist
418
+ end
419
+ def self.sealed_violation_whitelist
420
+ @sealed_violation_whitelist
421
+ end
422
+
396
423
  private_class_method def self.validate_lambda_given!(value)
397
424
  if !value.nil? && !value.respond_to?(:call)
398
425
  raise ArgumentError.new("Provided value must respond to :call")
@@ -54,6 +54,11 @@ module T::Private::Sealed
54
54
  end
55
55
 
56
56
  if !this_file.start_with?(decl_file)
57
+ whitelist = T::Configuration.sealed_violation_whitelist
58
+ if whitelist != nil && whitelist.any? {|pattern| decl_file =~ pattern}
59
+ return
60
+ end
61
+
57
62
  raise "#{parent} was declared sealed and can only be #{verb} in #{decl_file}, not #{this_file}"
58
63
  end
59
64
  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.5247
4
+ version: 0.5.5255
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-14 00:00:00.000000000 Z
11
+ date: 2020-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest