type_toolkit 0.0.5 → 0.0.6

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -0
  3. data/benchmark/.rubocop.yml +7 -0
  4. data/benchmark/abstract_methods_benchmark.rb +221 -0
  5. data/benchmark/interface_startup_performance.rb +128 -0
  6. data/benchmark/module_benchmark.rb +62 -0
  7. data/config/default.yml +5 -0
  8. data/docs/design/inherited_implementation_problem.md +119 -0
  9. data/docs/design/self_dot_methods.md +79 -0
  10. data/lib/rubocop/cop/type_toolkit/plugin.rb +1 -1
  11. data/lib/rubocop/cop/type_toolkit/prefer_not_nil.rb +96 -0
  12. data/lib/rubocop-type_toolkit.rb +1 -0
  13. data/lib/type_toolkit/abstract_method_receiver.rb +39 -0
  14. data/lib/type_toolkit/dsl.rb +64 -0
  15. data/lib/type_toolkit/ext/method.rb +11 -0
  16. data/lib/type_toolkit/ext/module.rb +7 -0
  17. data/lib/type_toolkit/ext/nil_assertions.rb +3 -1
  18. data/lib/type_toolkit/has_abstract_methods.rb +108 -0
  19. data/lib/type_toolkit/interface.rb +38 -0
  20. data/lib/type_toolkit/method_def_recorder.rb +53 -0
  21. data/lib/type_toolkit/method_patch.rb +16 -0
  22. data/lib/type_toolkit/version.rb +1 -1
  23. data/lib/type_toolkit.rb +3 -0
  24. data/sorbet/config +3 -1
  25. data/sorbet/rbi/gems/benchmark-ips@2.14.0.rbi +981 -0
  26. data/sorbet/rbi/gems/{erb@6.0.1.rbi → erb@6.0.1.1.rbi} +2 -2
  27. data/sorbet/rbi/gems/{json@2.18.1.rbi → json@2.19.9.rbi} +115 -161
  28. data/sorbet/rbi/gems/minitest@5.27.0.rbi +707 -0
  29. data/sorbet/rbi/gems/rexml@3.4.4.rbi +0 -167
  30. data/sorbet/rbi/gems/rubocop-ast@1.49.0.rbi +6 -0
  31. data/sorbet/rbi/gems/rubocop@1.84.2.rbi +7 -0
  32. data/sorbet/rbi/gems/tapioca@0.17.10.rbi +1 -0
  33. data/sorbet/rbi/gems/{yard@0.9.38.rbi → yard@0.9.44.rbi} +1206 -241
  34. data/sorbet/rbi/shims/core.rbi +19 -0
  35. data/sorbet/rbi/shims/minitest.rbi +5 -2
  36. data/spec/interface_spec.rb +405 -0
  37. data/spec/rubocop/cop/type_toolkit/prefer_not_nil_spec.rb +229 -0
  38. data/spec/spec_helper.rb +14 -0
  39. metadata +23 -4
@@ -1324,31 +1324,15 @@ class REXML::Document < ::REXML::Element
1324
1324
  def namespaces_cache=(_arg0); end
1325
1325
 
1326
1326
  class << self
1327
- # Get the entity expansion limit. By default the limit is set to 10000.
1328
- #
1329
- # Deprecated. Use REXML::Security.entity_expansion_limit= instead.
1330
- #
1331
1327
  # source://rexml//lib/rexml/document.rb#419
1332
1328
  def entity_expansion_limit; end
1333
1329
 
1334
- # Set the entity expansion limit. By default the limit is set to 10000.
1335
- #
1336
- # Deprecated. Use REXML::Security.entity_expansion_limit= instead.
1337
- #
1338
1330
  # source://rexml//lib/rexml/document.rb#412
1339
1331
  def entity_expansion_limit=(val); end
1340
1332
 
1341
- # Get the entity expansion limit. By default the limit is set to 10240.
1342
- #
1343
- # Deprecated. Use REXML::Security.entity_expansion_text_limit instead.
1344
- #
1345
1333
  # source://rexml//lib/rexml/document.rb#433
1346
1334
  def entity_expansion_text_limit; end
1347
1335
 
1348
- # Set the entity expansion limit. By default the limit is set to 10240.
1349
- #
1350
- # Deprecated. Use REXML::Security.entity_expansion_text_limit= instead.
1351
- #
1352
1336
  # source://rexml//lib/rexml/document.rb#426
1353
1337
  def entity_expansion_text_limit=(val); end
1354
1338
 
@@ -3335,11 +3319,6 @@ class REXML::Entity < ::REXML::Child
3335
3319
  def write(out, indent = T.unsafe(nil)); end
3336
3320
 
3337
3321
  class << self
3338
- # Evaluates whether the given string matches an entity definition,
3339
- # returning true if so, and false otherwise.
3340
- #
3341
- # @return [Boolean]
3342
- #
3343
3322
  # source://rexml//lib/rexml/entity.rb#67
3344
3323
  def matches?(string); end
3345
3324
  end
@@ -3501,45 +3480,30 @@ module REXML::Functions
3501
3480
  # source://rexml//lib/rexml/functions.rb#190
3502
3481
  def concat(*objects); end
3503
3482
 
3504
- # Fixed by Mike Stok
3505
- #
3506
3483
  # source://rexml//lib/rexml/functions.rb#204
3507
3484
  def contains(string, test); end
3508
3485
 
3509
3486
  # source://rexml//lib/rexml/functions.rb#38
3510
3487
  def context=(value); end
3511
3488
 
3512
- # Returns the size of the given list of nodes.
3513
- #
3514
3489
  # source://rexml//lib/rexml/functions.rb#60
3515
3490
  def count(node_set); end
3516
3491
 
3517
- # UNTESTED
3518
- #
3519
3492
  # source://rexml//lib/rexml/functions.rb#347
3520
3493
  def false; end
3521
3494
 
3522
3495
  # source://rexml//lib/rexml/functions.rb#413
3523
3496
  def floor(number); end
3524
3497
 
3525
- # Helper method.
3526
- #
3527
3498
  # source://rexml//lib/rexml/functions.rb#87
3528
3499
  def get_namespace(node_set = T.unsafe(nil)); end
3529
3500
 
3530
- # Since REXML is non-validating, this method is not implemented as it
3531
- # requires a DTD
3532
- #
3533
3501
  # source://rexml//lib/rexml/functions.rb#66
3534
3502
  def id(object); end
3535
3503
 
3536
- # UNTESTED
3537
- #
3538
3504
  # source://rexml//lib/rexml/functions.rb#352
3539
3505
  def lang(language); end
3540
3506
 
3541
- # Returns the last node of the given list of nodes.
3542
- #
3543
3507
  # source://rexml//lib/rexml/functions.rb#51
3544
3508
  def last; end
3545
3509
 
@@ -3561,25 +3525,9 @@ module REXML::Functions
3561
3525
  # source://rexml//lib/rexml/functions.rb#265
3562
3526
  def normalize_space(string = T.unsafe(nil)); end
3563
3527
 
3564
- # UNTESTED
3565
- #
3566
3528
  # source://rexml//lib/rexml/functions.rb#337
3567
3529
  def not(object); end
3568
3530
 
3569
- # a string that consists of optional whitespace followed by an optional
3570
- # minus sign followed by a Number followed by whitespace is converted to
3571
- # the IEEE 754 number that is nearest (according to the IEEE 754
3572
- # round-to-nearest rule) to the mathematical value represented by the
3573
- # string; any other string is converted to NaN
3574
- #
3575
- # boolean true is converted to 1; boolean false is converted to 0
3576
- #
3577
- # a node-set is first converted to a string as if by a call to the string
3578
- # function and then converted in the same way as a string argument
3579
- #
3580
- # an object of a type other than the four basic types is converted to a
3581
- # number in a way that is dependent on that type
3582
- #
3583
3531
  # source://rexml//lib/rexml/functions.rb#387
3584
3532
  def number(object = T.unsafe(nil)); end
3585
3533
 
@@ -3598,77 +3546,24 @@ module REXML::Functions
3598
3546
  # source://rexml//lib/rexml/functions.rb#26
3599
3547
  def singleton_method_added(name); end
3600
3548
 
3601
- # Fixed by Mike Stok
3602
- #
3603
3549
  # source://rexml//lib/rexml/functions.rb#199
3604
3550
  def starts_with(string, test); end
3605
3551
 
3606
- # A node-set is converted to a string by returning the string-value of the
3607
- # node in the node-set that is first in document order. If the node-set is
3608
- # empty, an empty string is returned.
3609
- #
3610
- # A number is converted to a string as follows
3611
- #
3612
- # NaN is converted to the string NaN
3613
- #
3614
- # positive zero is converted to the string 0
3615
- #
3616
- # negative zero is converted to the string 0
3617
- #
3618
- # positive infinity is converted to the string Infinity
3619
- #
3620
- # negative infinity is converted to the string -Infinity
3621
- #
3622
- # if the number is an integer, the number is represented in decimal form
3623
- # as a Number with no decimal point and no leading zeros, preceded by a
3624
- # minus sign (-) if the number is negative
3625
- #
3626
- # otherwise, the number is represented in decimal form as a Number
3627
- # including a decimal point with at least one digit before the decimal
3628
- # point and at least one digit after the decimal point, preceded by a
3629
- # minus sign (-) if the number is negative; there must be no leading zeros
3630
- # before the decimal point apart possibly from the one required digit
3631
- # immediately before the decimal point; beyond the one required digit
3632
- # after the decimal point there must be as many, but only as many, more
3633
- # digits as are needed to uniquely distinguish the number from all other
3634
- # IEEE 754 numeric values.
3635
- #
3636
- # The boolean false value is converted to the string false. The boolean
3637
- # true value is converted to the string true.
3638
- #
3639
- # An object of a type other than the four basic types is converted to a
3640
- # string in a way that is dependent on that type.
3641
- #
3642
3552
  # source://rexml//lib/rexml/functions.rb#138
3643
3553
  def string(object = T.unsafe(nil)); end
3644
3554
 
3645
- # UNTESTED
3646
- #
3647
3555
  # source://rexml//lib/rexml/functions.rb#261
3648
3556
  def string_length(string); end
3649
3557
 
3650
- # A node-set is converted to a string by
3651
- # returning the concatenation of the string-value
3652
- # of each of the children of the node in the
3653
- # node-set that is first in document order.
3654
- # If the node-set is empty, an empty string is returned.
3655
- #
3656
3558
  # source://rexml//lib/rexml/functions.rb#178
3657
3559
  def string_value(o); end
3658
3560
 
3659
- # Take equal portions of Mike Stok and Sean Russell; mix
3660
- # vigorously, and pour into a tall, chilled glass. Serves 10,000.
3661
- #
3662
3561
  # source://rexml//lib/rexml/functions.rb#228
3663
3562
  def substring(string, start, length = T.unsafe(nil)); end
3664
3563
 
3665
- # Kouhei fixed this too
3666
- #
3667
3564
  # source://rexml//lib/rexml/functions.rb#220
3668
3565
  def substring_after(string, test); end
3669
3566
 
3670
- # Kouhei fixed this
3671
- #
3672
3567
  # source://rexml//lib/rexml/functions.rb#209
3673
3568
  def substring_before(string, test); end
3674
3569
 
@@ -3678,13 +3573,9 @@ module REXML::Functions
3678
3573
  # source://rexml//lib/rexml/functions.rb#40
3679
3574
  def text; end
3680
3575
 
3681
- # This is entirely Mike Stok's beast
3682
- #
3683
3576
  # source://rexml//lib/rexml/functions.rb#275
3684
3577
  def translate(string, tr1, tr2); end
3685
3578
 
3686
- # UNTESTED
3687
- #
3688
3579
  # source://rexml//lib/rexml/functions.rb#342
3689
3580
  def true; end
3690
3581
 
@@ -4690,11 +4581,6 @@ REXML::Source::Private::SPACES_PATTERN = T.let(T.unsafe(nil), Regexp)
4690
4581
  # source://rexml//lib/rexml/source.rb#38
4691
4582
  class REXML::SourceFactory
4692
4583
  class << self
4693
- # Generates a Source object
4694
- #
4695
- # @param arg Either a String, or an IO
4696
- # @return a Source, or nil if a bad argument was given
4697
- #
4698
4584
  # source://rexml//lib/rexml/source.rb#42
4699
4585
  def create_from(arg); end
4700
4586
  end
@@ -4880,26 +4766,18 @@ class REXML::Text < ::REXML::Child
4880
4766
  def clear_cache; end
4881
4767
 
4882
4768
  class << self
4883
- # check for illegal characters
4884
- #
4885
4769
  # source://rexml//lib/rexml/text.rb#116
4886
4770
  def check(string, pattern, doctype = T.unsafe(nil)); end
4887
4771
 
4888
4772
  # source://rexml//lib/rexml/text.rb#401
4889
4773
  def expand(ref, doctype, filter); end
4890
4774
 
4891
- # Escapes all possible entities
4892
- #
4893
4775
  # source://rexml//lib/rexml/text.rb#363
4894
4776
  def normalize(input, doctype = T.unsafe(nil), entity_filter = T.unsafe(nil)); end
4895
4777
 
4896
- # Reads text, substituting entities
4897
- #
4898
4778
  # source://rexml//lib/rexml/text.rb#337
4899
4779
  def read_with_substitution(input, illegal = T.unsafe(nil)); end
4900
4780
 
4901
- # Unescapes all possible entities
4902
- #
4903
4781
  # source://rexml//lib/rexml/text.rb#387
4904
4782
  def unnormalize(string, doctype = T.unsafe(nil), filter = T.unsafe(nil), illegal = T.unsafe(nil), entity_expansion_text_limit: T.unsafe(nil)); end
4905
4783
  end
@@ -5014,12 +4892,6 @@ class REXML::XMLDecl < ::REXML::Child
5014
4892
  def content(enc); end
5015
4893
 
5016
4894
  class << self
5017
- # Only use this if you do not want the XML declaration to be written;
5018
- # this object is ignored by the XML writer. Otherwise, instantiate your
5019
- # own XMLDecl and add it to the document.
5020
- #
5021
- # Note that XML 1.1 documents *must* include an XML declaration
5022
- #
5023
4895
  # source://rexml//lib/rexml/xmldecl.rb#92
5024
4896
  def default; end
5025
4897
  end
@@ -5032,51 +4904,12 @@ class REXML::XPath
5032
4904
  include ::REXML::Functions
5033
4905
 
5034
4906
  class << self
5035
- # Iterates over nodes that match the given path, calling the supplied
5036
- # block with the match.
5037
- # element::
5038
- # The context element
5039
- # path::
5040
- # The xpath to search for. If not supplied or nil, defaults to '*'
5041
- # namespaces::
5042
- # If supplied, a Hash which defines a namespace mapping
5043
- # variables::
5044
- # If supplied, a Hash which maps $variables in the query
5045
- # to values. This can be used to avoid XPath injection attacks
5046
- # or to automatically handle escaping string values.
5047
- #
5048
- # XPath.each( node ) { |el| ... }
5049
- # XPath.each( node, '/*[@attr='v']' ) { |el| ... }
5050
- # XPath.each( node, 'ancestor::x' ) { |el| ... }
5051
- # XPath.each( node, '/book/publisher/text()=$publisher', {}, {"publisher"=>"O'Reilly"}) \
5052
- # {|el| ... }
5053
- #
5054
4907
  # source://rexml//lib/rexml/xpath.rb#55
5055
4908
  def each(element, path = T.unsafe(nil), namespaces = T.unsafe(nil), variables = T.unsafe(nil), options = T.unsafe(nil), &block); end
5056
4909
 
5057
- # Finds and returns the first node that matches the supplied xpath.
5058
- # element::
5059
- # The context element
5060
- # path::
5061
- # The xpath to search for. If not supplied or nil, returns the first
5062
- # node matching '*'.
5063
- # namespaces::
5064
- # If supplied, a Hash which defines a namespace mapping.
5065
- # variables::
5066
- # If supplied, a Hash which maps $variables in the query
5067
- # to values. This can be used to avoid XPath injection attacks
5068
- # or to automatically handle escaping string values.
5069
- #
5070
- # XPath.first( node )
5071
- # XPath.first( doc, "//b"} )
5072
- # XPath.first( node, "a/x:b", { "x"=>"http://doofus" } )
5073
- # XPath.first( node, '/book/publisher/text()=$publisher', {}, {"publisher"=>"O'Reilly"})
5074
- #
5075
4910
  # source://rexml//lib/rexml/xpath.rb#31
5076
4911
  def first(element, path = T.unsafe(nil), namespaces = T.unsafe(nil), variables = T.unsafe(nil), options = T.unsafe(nil)); end
5077
4912
 
5078
- # Returns an array of nodes matching a given XPath.
5079
- #
5080
4913
  # source://rexml//lib/rexml/xpath.rb#62
5081
4914
  def match(element, path = T.unsafe(nil), namespaces = T.unsafe(nil), variables = T.unsafe(nil), options = T.unsafe(nil)); end
5082
4915
  end
@@ -5563,6 +5563,9 @@ RuboCop::AST::NodePattern::Sets::SET_MAP_COLLECT = T.let(T.unsafe(nil), Set)
5563
5563
  # source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
5564
5564
  RuboCop::AST::NodePattern::Sets::SET_MAP_FILTER_MAP = T.let(T.unsafe(nil), Set)
5565
5565
 
5566
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
5567
+ RuboCop::AST::NodePattern::Sets::SET_MATCH_MATCH_ = T.let(T.unsafe(nil), Set)
5568
+
5566
5569
  # source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
5567
5570
  RuboCop::AST::NodePattern::Sets::SET_MODULE_FUNCTION_RUBY2_KEYWORDS = T.let(T.unsafe(nil), Set)
5568
5571
 
@@ -5644,6 +5647,9 @@ RuboCop::AST::NodePattern::Sets::SET_STRUCT_CLASS = T.let(T.unsafe(nil), Set)
5644
5647
  # source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
5645
5648
  RuboCop::AST::NodePattern::Sets::SET_SUCC_PRED_NEXT = T.let(T.unsafe(nil), Set)
5646
5649
 
5650
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
5651
+ RuboCop::AST::NodePattern::Sets::SET_TASK_NAMESPACE = T.let(T.unsafe(nil), Set)
5652
+
5647
5653
  # source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
5648
5654
  RuboCop::AST::NodePattern::Sets::SET_TO_ENUM_ENUM_FOR = T.let(T.unsafe(nil), Set)
5649
5655
 
@@ -29997,6 +29997,13 @@ module RuboCop::Cop::MinBranchesCount
29997
29997
  def min_branches_count?(node); end
29998
29998
  end
29999
29999
 
30000
+ module RuboCop::Cop::Minitest; end
30001
+
30002
+ class RuboCop::Cop::Minitest::MultipleAssertions < ::RuboCop::Cop::Base
30003
+ include ::RuboCop::Cop::VisibilityHelp
30004
+ include ::RuboCop::Cop::DefNode
30005
+ end
30006
+
30000
30007
  # Common code for indenting the first elements in multiline
30001
30008
  # array literals, hash literals, and method definitions.
30002
30009
  #
@@ -3116,6 +3116,7 @@ Tapioca::Runtime::SourceLocation::EVAL_SOURCE_FILE_PATTERN = T.let(T.unsafe(nil)
3116
3116
  # source://tapioca//lib/tapioca/runtime/trackers/autoload.rb#6
3117
3117
  module Tapioca::Runtime::Trackers
3118
3118
  class << self
3119
+ # source://tapioca//lib/tapioca/runtime/trackers.rb#30
3119
3120
  def disable_all!; end
3120
3121
 
3121
3122
  # source://tapioca//lib/tapioca/runtime/trackers.rb#35