rbs 1.0.4 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +2 -2
  3. data/CHANGELOG.md +95 -0
  4. data/Rakefile +5 -2
  5. data/Steepfile +2 -0
  6. data/bin/rbs-prof +1 -1
  7. data/core/array.rbs +11 -7
  8. data/core/complex.rbs +1 -1
  9. data/core/enumerable.rbs +16 -2
  10. data/core/enumerator.rbs +4 -0
  11. data/core/file.rbs +2 -1
  12. data/core/hash.rbs +13 -5
  13. data/core/integer.rbs +2 -1
  14. data/core/io.rbs +3 -3
  15. data/core/module.rbs +2 -2
  16. data/core/numeric.rbs +10 -0
  17. data/core/proc.rbs +1 -1
  18. data/core/random.rbs +4 -2
  19. data/core/range.rbs +2 -2
  20. data/core/rational.rbs +2 -1
  21. data/core/string.rbs +2 -1
  22. data/core/struct.rbs +3 -2
  23. data/core/symbol.rbs +2 -1
  24. data/core/thread.rbs +15 -2
  25. data/core/time.rbs +2 -1
  26. data/docs/CONTRIBUTING.md +5 -3
  27. data/docs/sigs.md +18 -1
  28. data/docs/stdlib.md +1 -1
  29. data/docs/syntax.md +11 -11
  30. data/lib/rbs.rb +4 -0
  31. data/lib/rbs/ancestor_graph.rb +90 -0
  32. data/lib/rbs/ast/annotation.rb +2 -2
  33. data/lib/rbs/ast/comment.rb +2 -2
  34. data/lib/rbs/ast/declarations.rb +37 -22
  35. data/lib/rbs/ast/members.rb +39 -26
  36. data/lib/rbs/char_scanner.rb +20 -0
  37. data/lib/rbs/cli.rb +3 -0
  38. data/lib/rbs/constant_table.rb +4 -1
  39. data/lib/rbs/definition.rb +1 -1
  40. data/lib/rbs/definition_builder.rb +64 -25
  41. data/lib/rbs/definition_builder/ancestor_builder.rb +1 -0
  42. data/lib/rbs/definition_builder/method_builder.rb +27 -4
  43. data/lib/rbs/environment.rb +42 -5
  44. data/lib/rbs/environment_walker.rb +4 -4
  45. data/lib/rbs/errors.rb +32 -17
  46. data/lib/rbs/location.rb +106 -2
  47. data/lib/rbs/locator.rb +205 -0
  48. data/lib/rbs/method_type.rb +2 -2
  49. data/lib/rbs/parser.rb +1154 -796
  50. data/lib/rbs/parser.y +432 -87
  51. data/lib/rbs/test/hook.rb +8 -2
  52. data/lib/rbs/test/type_check.rb +7 -3
  53. data/lib/rbs/type_name.rb +2 -3
  54. data/lib/rbs/type_name_resolver.rb +1 -1
  55. data/lib/rbs/types.rb +36 -34
  56. data/lib/rbs/version.rb +1 -1
  57. data/lib/rbs/writer.rb +4 -2
  58. data/sig/ancestor_graph.rbs +40 -0
  59. data/sig/annotation.rbs +1 -1
  60. data/sig/char_scanner.rbs +9 -0
  61. data/sig/cli.rbs +31 -21
  62. data/sig/comment.rbs +1 -1
  63. data/sig/declarations.rbs +106 -21
  64. data/sig/definition_builder.rbs +5 -1
  65. data/sig/environment.rbs +24 -4
  66. data/sig/environment_walker.rbs +39 -0
  67. data/sig/errors.rbs +42 -17
  68. data/sig/location.rbs +84 -3
  69. data/sig/locator.rbs +44 -0
  70. data/sig/members.rbs +77 -11
  71. data/sig/method_builder.rbs +3 -1
  72. data/sig/method_types.rbs +1 -1
  73. data/sig/parser.rbs +11 -4
  74. data/sig/polyfill.rbs +13 -22
  75. data/sig/rbs.rbs +8 -4
  76. data/sig/typename.rbs +1 -1
  77. data/sig/types.rbs +67 -20
  78. data/sig/util.rbs +0 -4
  79. data/sig/writer.rbs +8 -2
  80. data/stdlib/bigdecimal/0/big_decimal.rbs +1 -1
  81. data/stdlib/cgi/0/core.rbs +595 -0
  82. data/stdlib/date/0/date.rbs +1 -1
  83. data/stdlib/json/0/json.rbs +288 -0
  84. data/stdlib/pathname/0/pathname.rbs +2 -1
  85. data/stdlib/rubygems/0/basic_specification.rbs +3 -0
  86. data/stdlib/rubygems/0/config_file.rbs +3 -0
  87. data/stdlib/rubygems/0/dependency_installer.rbs +5 -0
  88. data/stdlib/rubygems/0/installer.rbs +3 -0
  89. data/stdlib/rubygems/0/path_support.rbs +3 -0
  90. data/stdlib/rubygems/0/platform.rbs +3 -0
  91. data/stdlib/rubygems/0/request_set.rbs +7 -0
  92. data/stdlib/rubygems/0/requirement.rbs +85 -0
  93. data/stdlib/rubygems/0/rubygems.rbs +710 -0
  94. data/stdlib/rubygems/0/source_list.rbs +2 -0
  95. data/stdlib/rubygems/0/specification.rbs +3 -0
  96. data/stdlib/rubygems/0/stream_ui.rbs +3 -0
  97. data/stdlib/rubygems/0/uninstaller.rbs +3 -0
  98. data/stdlib/rubygems/0/version.rbs +229 -0
  99. data/stdlib/set/0/set.rbs +7 -0
  100. data/stdlib/shellwords/0/shellwords.rbs +252 -0
  101. data/stdlib/strscan/0/string_scanner.rbs +582 -0
  102. data/stdlib/timeout/0/timeout.rbs +57 -0
  103. data/stdlib/uri/0/rfc2396_parser.rbs +144 -7
  104. data/steep/Gemfile.lock +22 -21
  105. metadata +27 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a74db23528adc1dec1cf74a16e9d673ab7bba904e5f9dfb5d32fd48a9a55e5f
4
- data.tar.gz: 126f9160565fb35f91598376ef0d0ef7589a940c99399a983cbc35f6a9a355c5
3
+ metadata.gz: 3be8bb7e853829dddbff29b1a3337a33fd61e2860f6c83771dfdbe2ad097eb75
4
+ data.tar.gz: e569b69fe73f92c80e621521be85e8292fdb43a14d4f1fdc8f7537cdd04efbb5
5
5
  SHA512:
6
- metadata.gz: dda7d98e9e01acef22765c4683e081e93c871eb5280d294940685e736716050bf8b4f6cc9d546c987c5932238df9d0f349d04c1becc6bd48832ca202ff69331b
7
- data.tar.gz: 3d40ac86d0b6c044822b6e48af4c9c3414feab9ab6924f205c2e1163818301e0428895e62f8a2a55cb5dfd6e3175d2b556d2390a22de6533de998756949a99b0
6
+ metadata.gz: 53895724feba94cfc7695ee7013f7cfa83618d566f4eec14fab0b5bed00074cda0394668a92d1f9eaa572bc3f0d8099a2f0bf201b05a444b3b2b8201c797ed48
7
+ data.tar.gz: 924a8b04e9b88464b5443fc1b8269cd20cfbfb25e04cc93737d52bbe1b4a895ac389371e373129ac6238a1152369ce71c3cca9183608fc9cebca4f571effc018
@@ -27,10 +27,10 @@ jobs:
27
27
  run: |
28
28
  apt-get update
29
29
  apt-get install -y libdb-dev
30
- - name: Install bundler
30
+ - name: Update rubygems & bundler
31
31
  run: |
32
32
  ruby -v
33
- gem install bundler
33
+ gem update --system
34
34
  - name: bundle config set with
35
35
  run: |
36
36
  echo "NO_MINITEST=true" >> $GITHUB_ENV
data/CHANGELOG.md CHANGED
@@ -2,6 +2,101 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.2.0 (2021-04-21)
6
+
7
+ ### Summary
8
+
9
+ RBS 1.2 ships with better support for AST/token locations and `Locator` utility class. The AST objects now keep the locations of tokens. The `Locator` class is to translate the text position (line and column) to semantic object at the location. The class allows to find if a text position is on the class name of a class declaration.
10
+
11
+ ### Signature updates
12
+
13
+ * Hash ([#631](https://github.com/ruby/rbs/pull/631), [#632](https://github.com/ruby/rbs/pull/632), [\#637](https://github.com/ruby/rbs/pull/637), [\#638](https://github.com/ruby/rbs/pull/638), [\#639](https://github.com/ruby/rbs/pull/639), )
14
+ * Module ([\#645](https://github.com/ruby/rbs/pull/645))
15
+ * Enumerable ([\#647](https://github.com/ruby/rbs/pull/647))
16
+ * Array ([\#648](https://github.com/ruby/rbs/pull/648))
17
+ * Proc ([\#649](https://github.com/ruby/rbs/pull/649))
18
+ * Struct ([\#650](https://github.com/ruby/rbs/pull/650), [\#668](https://github.com/ruby/rbs/pull/668))
19
+ * Thread ([\#651](https://github.com/ruby/rbs/pull/651))
20
+ * Random ([\#669](https://github.com/ruby/rbs/pull/669))
21
+ * Shellwords ([\#665](https://github.com/ruby/rbs/pull/665))
22
+ * IO ([\#659](https://github.com/ruby/rbs/pull/659))
23
+
24
+ ### Language updates
25
+
26
+ * Module self type syntax update ([\#653](https://github.com/ruby/rbs/pull/653))
27
+
28
+ ### Library changes
29
+
30
+ * Token locations ([\#666](https://github.com/ruby/rbs/pull/666))
31
+ * Add RBS::Locator ([\#667](https://github.com/ruby/rbs/pull/667))
32
+ * Fix runtime type checker ([\#644](https://github.com/ruby/rbs/pull/644))
33
+
34
+ ### Miscellaneous
35
+
36
+ * Update documentation for overloading ([\#658](https://github.com/ruby/rbs/pull/658))
37
+ * Update target ruby version ([\#633](https://github.com/ruby/rbs/pull/633))
38
+
39
+ ## 1.1.1 (2021-03-12)
40
+
41
+ ### Signature updates
42
+
43
+ * rubygem ([#630](https://github.com/ruby/rbs/pull/630))
44
+
45
+ ## 1.1.0 (2021-03-08)
46
+
47
+ ### Summary
48
+
49
+ Errors are now organized by `RBS::BaseError`, `RBS::ParsingError`, `RBS::LoadingError`, and `RBS::DefinitionError`.
50
+ The library users can rescue RBS related errors with `RBS::BaseError`, parsing errors with `RBS::ParsingError`, and other errors with `RBS::LoadingError` and `RBS::DefinitionErrors`.
51
+
52
+ Updating a part of environments are supported. Library users can remove declarations read from a set of files, adding new declarations, running name resolution related to the new decls, and deleting `DefinitionBuilder` caches related to the changes.
53
+ See `RBS::Environment#reject`, `RBS::Environment#resolve_type_names`, `RBS::AncestorGraph`, and `RBS::DefinitionBuilder#update`.
54
+
55
+ `RBS::DefinitionBuilder#build_singleton` now returns definitions containing `instance` type, which had returned resolved class instance types. This is a breaking change, but we consider it a bug fix because `RBS::DefinitionBuilder#build_instance` has returned `instance` types and `#build_singleton` has returned `class` type.
56
+
57
+ ### Signature updates
58
+
59
+ * rubygem ([\#605](https://github.com/ruby/rbs/pull/605), [\#610](https://github.com/ruby/rbs/pull/610))
60
+ * Array ([\#612](https://github.com/ruby/rbs/pull/612), [\#614](https://github.com/ruby/rbs/pull/614))
61
+ * cgi/core ([\#599](https://github.com/ruby/rbs/pull/599))
62
+ * Thread ([\#618](https://github.com/ruby/rbs/pull/618))
63
+
64
+ ### Language updates
65
+
66
+ * Allow trailing comma for Record and Tuple types ([\#606](https://github.com/ruby/rbs/pull/606))
67
+
68
+ ### Library changes
69
+
70
+ * Allow partial update of RBS declarations ([\#608](https://github.com/ruby/rbs/pull/608), [\#621](https://github.com/ruby/rbs/pull/621))
71
+ * Let errors have `TypeName` ([\#611](https://github.com/ruby/rbs/pull/611))
72
+ * Add `Parser::LexerError` ([\#615](https://github.com/ruby/rbs/pull/615))
73
+ * Performance improvement ([\#617](https://github.com/ruby/rbs/pull/617), [\#620](https://github.com/ruby/rbs/pull/620))
74
+ * No substitute `instance` types on `#build_singleton` ([\#619](https://github.com/ruby/rbs/pull/619))
75
+
76
+ ### Miscellaneous
77
+
78
+ * Make racc name customizable by `RACC` environment variable ([\#602](https://github.com/ruby/rbs/pull/602))
79
+ * Suppress warnings ([\#624](https://github.com/ruby/rbs/pull/624))
80
+ * Remove needless `Gem::Version` polyfill ([\#622](https://github.com/ruby/rbs/pull/622))
81
+
82
+ ## 1.0.6 (2021-02-17)
83
+
84
+ * Signature Updates
85
+ * `Enumerable` ([\#595](https://github.com/ruby/rbs/pull/595), [\#596](https://github.com/ruby/rbs/pull/596), [\#601](https://github.com/ruby/rbs/pull/601))
86
+ * `#as_json` ([\#597](https://github.com/ruby/rbs/pull/597))
87
+
88
+ ## 1.0.5 (2021-02-13)
89
+
90
+ * Signature Updates
91
+ * Enumerable ([\#596](https://github.com/ruby/rbs/pull/596))
92
+ * Set ([\#595](https://github.com/ruby/rbs/pull/595))
93
+ * `#to_json` ([\#592](https://github.com/ruby/rbs/pull/592))
94
+ * `<=>` ([\#593](https://github.com/ruby/rbs/pull/593))
95
+ * Timeout ([\#586](https://github.com/ruby/rbs/pull/586))
96
+ * URI::RFC2396_Parser ([\#587](https://github.com/ruby/rbs/pull/587))
97
+ * Rename generic class parameters on re-open ([\#594](https://github.com/ruby/rbs/pull/594))
98
+ * Make `refute_send_type` check that method call doesn't match with types in RBS ([\#588](https://github.com/ruby/rbs/pull/588))
99
+
5
100
  ## 1.0.4 (2021-01-31)
6
101
 
7
102
  * Unbundle `rr` to run test in `ruby/ruby` repo ([#585](https://github.com/ruby/rbs/pull/585))
data/Rakefile CHANGED
@@ -2,7 +2,10 @@ require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
  require "rbconfig"
4
4
 
5
+ $LOAD_PATH << File.join(__dir__, "test")
6
+
5
7
  ruby = ENV["RUBY"] || RbConfig.ruby
8
+ racc = ENV.fetch("RACC", "racc")
6
9
  rbs = File.join(__dir__, "exe/rbs")
7
10
  bin = File.join(__dir__, "bin")
8
11
 
@@ -67,7 +70,7 @@ task :rubocop do
67
70
  end
68
71
 
69
72
  rule ".rb" => ".y" do |t|
70
- sh "racc -v -o #{t.name} #{t.source}"
73
+ sh "#{racc} -v -o #{t.name} #{t.source}"
71
74
  end
72
75
 
73
76
  task :parser => "lib/rbs/parser.rb"
@@ -77,7 +80,7 @@ task :build => :parser
77
80
 
78
81
  task :confirm_parser do
79
82
  puts "Testing if parser.rb is updated with respect to parser.y"
80
- sh "racc -v -o lib/rbs/parser.rb lib/rbs/parser.y"
83
+ sh "#{racc} -v -o lib/rbs/parser.rb lib/rbs/parser.y"
81
84
  sh "git diff --exit-code lib/rbs/parser.rb"
82
85
  end
83
86
 
data/Steepfile CHANGED
@@ -5,6 +5,8 @@ target :lib do
5
5
  ignore "lib/rbs/prototype", "lib/rbs/test", "lib/rbs/test.rb"
6
6
 
7
7
  library "set", "pathname", "json", "logger", "monitor", "tsort"
8
+ signature "stdlib/strscan/0/"
9
+ signature "stdlib/rubygems/0/"
8
10
  end
9
11
 
10
12
  # target :lib do
data/bin/rbs-prof CHANGED
@@ -4,6 +4,6 @@ require "stackprof"
4
4
 
5
5
  out = ENV["RBS_STACKPROF_OUT"] || 'tmp/stackprof-cpu-rbs.dump'
6
6
 
7
- StackProf.run(mode: :cpu, out: out) do
7
+ StackProf.run(mode: :cpu, out: out, raw: true) do
8
8
  load File.join(__dir__, "../exe/rbs")
9
9
  end
data/core/array.rbs CHANGED
@@ -682,7 +682,7 @@ class Array[unchecked out Elem] < Object
682
682
  #
683
683
  # See also Array#+.
684
684
  #
685
- def concat: (*::Array[Elem] arrays) -> ::Array[Elem]
685
+ def concat: (*::Array[Elem] arrays) -> self
686
686
 
687
687
  # Returns the number of elements.
688
688
  #
@@ -1584,8 +1584,8 @@ class Array[unchecked out Elem] < Object
1584
1584
  # a.sample(random: Random.new(1)) #=> 6
1585
1585
  # a.sample(4, random: Random.new(1)) #=> [6, 10, 9, 2]
1586
1586
  #
1587
- def sample: (?random: Random rng) -> Elem?
1588
- | (?int n, ?random: Random rng) -> ::Array[Elem]
1587
+ def sample: (?random: _Rand rng) -> Elem?
1588
+ | (?int n, ?random: _Rand rng) -> ::Array[Elem]
1589
1589
 
1590
1590
  # Returns a new array containing all elements of `ary` for which the given
1591
1591
  # `block` returns a true value.
@@ -1649,7 +1649,7 @@ class Array[unchecked out Elem] < Object
1649
1649
  #
1650
1650
  # a.shuffle(random: Random.new(1)) #=> [1, 3, 2]
1651
1651
  #
1652
- def shuffle: (?random: Random rng) -> ::Array[Elem]
1652
+ def shuffle: (?random: _Rand rng) -> ::Array[Elem]
1653
1653
 
1654
1654
  # Shuffles elements in `self` in place.
1655
1655
  #
@@ -1661,7 +1661,7 @@ class Array[unchecked out Elem] < Object
1661
1661
  #
1662
1662
  # a.shuffle!(random: Random.new(1)) #=> [1, 3, 2]
1663
1663
  #
1664
- def shuffle!: (?random: Random rng) -> self
1664
+ def shuffle!: (?random: _Rand rng) -> self
1665
1665
 
1666
1666
  alias size length
1667
1667
 
@@ -1736,7 +1736,7 @@ class Array[unchecked out Elem] < Object
1736
1736
  # See also Enumerable#sort_by.
1737
1737
  #
1738
1738
  def sort: () -> ::Array[Elem]
1739
- | () { (Elem a, Elem b) -> ::Integer? } -> ::Array[Elem]
1739
+ | () { (Elem a, Elem b) -> ::Integer } -> ::Array[Elem]
1740
1740
 
1741
1741
  # Sorts `self` in place.
1742
1742
  #
@@ -1757,7 +1757,7 @@ class Array[unchecked out Elem] < Object
1757
1757
  # See also Enumerable#sort_by.
1758
1758
  #
1759
1759
  def sort!: () -> self
1760
- | () { (Elem a, Elem b) -> ::Integer? } -> self
1760
+ | () { (Elem a, Elem b) -> ::Integer } -> self
1761
1761
 
1762
1762
  # Sorts `self` in place using a set of keys generated by mapping the values in
1763
1763
  # `self` through the given block.
@@ -1997,6 +1997,10 @@ interface _ToAry[T]
1997
1997
  def to_ary: () -> ::Array[T]
1998
1998
  end
1999
1999
 
2000
+ interface _Rand
2001
+ def rand: (::Integer max) -> ::Integer
2002
+ end
2003
+
2000
2004
  interface Array::_Pattern[T]
2001
2005
  def ===: (T) -> bool
2002
2006
  end
data/core/complex.rbs CHANGED
@@ -121,7 +121,7 @@ class Complex < Numeric
121
121
  # Complex(2) <=> 2 #=> 0
122
122
  # Complex(2) <=> 3 #=> -1
123
123
  #
124
- def <=>: (Numeric) -> Integer?
124
+ def <=>: (untyped) -> Integer?
125
125
 
126
126
  # Returns true if cmp equals object numerically.
127
127
  #
data/core/enumerable.rbs CHANGED
@@ -118,7 +118,7 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
118
118
  # [].first(10) #=> []
119
119
  # ```
120
120
  def first: () -> Elem?
121
- | (Integer n) -> ::Array[Elem]?
121
+ | (_ToInt n) -> ::Array[Elem]
122
122
 
123
123
  def grep: (untyped arg0) -> ::Array[Elem]
124
124
  | [U] (untyped arg0) { (Elem arg0) -> U } -> ::Array[U]
@@ -286,8 +286,22 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
286
286
  def sort_by: () { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> ::Array[Elem]
287
287
  | () -> ::Enumerator[Elem, ::Array[Elem]]
288
288
 
289
- def take: (Integer n) -> ::Array[Elem]?
289
+ # Returns first n elements from *enum*.
290
+ #
291
+ # a = [1, 2, 3, 4, 5, 0]
292
+ # a.take(3) #=> [1, 2, 3]
293
+ # a.take(30) #=> [1, 2, 3, 4, 5, 0]
294
+ #
295
+ def take: (Integer n) -> ::Array[Elem]
290
296
 
297
+ # Passes elements to the block until the block returns `nil` or `false`, then
298
+ # stops iterating and returns an array of all prior elements.
299
+ #
300
+ # If no block is given, an enumerator is returned instead.
301
+ #
302
+ # a = [1, 2, 3, 4, 5, 0]
303
+ # a.take_while { |i| i < 3 } #=> [1, 2]
304
+ #
291
305
  def take_while: () { (Elem) -> boolish } -> ::Array[Elem]
292
306
  | () -> ::Enumerator[Elem, ::Array[Elem]]
293
307
 
data/core/enumerator.rbs CHANGED
@@ -244,6 +244,8 @@ end
244
244
 
245
245
  class Enumerator::Generator[out Elem] < Object
246
246
  include Enumerable[Elem]
247
+
248
+ def each: () { (Elem) -> void } -> void
247
249
  end
248
250
 
249
251
  class Enumerator::Lazy[out Elem, out Return] < Enumerator[Elem, Return]
@@ -259,4 +261,6 @@ end
259
261
 
260
262
  class Enumerator::Chain[out Elem] < Object
261
263
  include Enumerable[Elem]
264
+
265
+ def each: () { (Elem) -> void } -> void
262
266
  end
data/core/file.rbs CHANGED
@@ -985,7 +985,8 @@ class File::Stat < Object
985
985
  include Comparable
986
986
 
987
987
  def initialize: (String file) -> Object
988
- def <=>: (File::Stat other) -> Integer?
988
+ def <=>: (File::Stat other) -> Integer
989
+ | (untyped) -> nil
989
990
 
990
991
  def atime: () -> Time
991
992
 
data/core/hash.rbs CHANGED
@@ -256,7 +256,7 @@ class Hash[unchecked out K, unchecked out V] < Object
256
256
  # h.compact #=> { a: 1, b: false }
257
257
  # h #=> { a: 1, b: false, c: nil }
258
258
  #
259
- def compact: () -> self
259
+ def compact: () -> ::Hash[K, V]
260
260
 
261
261
  # Removes all nil values from the hash. Returns nil if no changes were made,
262
262
  # otherwise returns the hash.
@@ -450,6 +450,14 @@ class Hash[unchecked out K, unchecked out V] < Object
450
450
  #
451
451
  def eql?: (untyped) -> bool
452
452
 
453
+ # Returns a hash excluded given keys and the values.
454
+ #
455
+ # h = { a: 100, b: 200, c: 300 }
456
+ # h.except(:a) #=> {:b=>200, :c=>300}
457
+ # h.except(:b, :c, :d) #=> {:a=>100}
458
+ #
459
+ def except: (*K) -> ::Hash[K, V]
460
+
453
461
  # Returns a value from the hash for the given key. If the key can't be found,
454
462
  # there are several options: With no other arguments, it will raise a KeyError
455
463
  # exception; if *default* is given, then that will be returned; if the optional
@@ -498,8 +506,8 @@ class Hash[unchecked out K, unchecked out V] < Object
498
506
  #
499
507
  # Hash#filter is an alias for Hash#select.
500
508
  #
501
- def filter: () { (K, V) -> boolish } -> self
502
- | () -> ::Enumerator[[ K, V ], self]
509
+ def filter: () { (K, V) -> boolish } -> ::Hash[K, V]
510
+ | () -> ::Enumerator[[ K, V ], ::Hash[K, V]]
503
511
 
504
512
  # Equivalent to Hash#keep_if, but returns `nil` if no changes were made.
505
513
  #
@@ -815,7 +823,7 @@ class Hash[unchecked out K, unchecked out V] < Object
815
823
  # h.slice(:a) #=> {:a=>100}
816
824
  # h.slice(:b, :c, :d) #=> {:b=>200, :c=>300}
817
825
  #
818
- def slice: (*K) -> self
826
+ def slice: (*K) -> ::Hash[K, V]
819
827
 
820
828
  # ## Element Assignment
821
829
  #
@@ -857,7 +865,7 @@ class Hash[unchecked out K, unchecked out V] < Object
857
865
 
858
866
  # Returns `self`.
859
867
  #
860
- def to_hash: () -> ::Hash[K, V]
868
+ def to_hash: () -> self
861
869
 
862
870
  # Returns a Proc which maps keys to values.
863
871
  #
data/core/integer.rbs CHANGED
@@ -112,7 +112,8 @@ class Integer < Numeric
112
112
  #
113
113
  # `nil` is returned if the two values are incomparable.
114
114
  #
115
- def <=>: (Numeric) -> Integer?
115
+ def <=>: (Integer | Rational) -> Integer
116
+ | (untyped) -> Integer?
116
117
 
117
118
  # Returns `true` if `int` equals `other` numerically. Contrast this with
118
119
  # Integer#eql?, which requires `other` to be an Integer.
data/core/io.rbs CHANGED
@@ -181,7 +181,7 @@ class IO < Object
181
181
  # # ...
182
182
  # f.gets # won't cause Errno::EBADF
183
183
  #
184
- def autoclose=: (bool) -> bool
184
+ def autoclose=: (boolish) -> untyped
185
185
 
186
186
  # Returns `true` if the underlying file descriptor of *ios* will be closed
187
187
  # automatically at its finalization, otherwise `false`.
@@ -212,7 +212,7 @@ class IO < Object
212
212
  # just ignored since Ruby 2.3.
213
213
  def close: () -> NilClass
214
214
 
215
- def close_on_exec=: (boolish) -> bool
215
+ def close_on_exec=: (boolish) -> untyped
216
216
 
217
217
  # Returns `true` if *ios* will be closed on exec.
218
218
  #
@@ -656,7 +656,7 @@ class IO < Object
656
656
  # ```
657
657
  def sync: () -> bool
658
658
 
659
- def sync=: (boolish) -> bool
659
+ def sync=: (boolish) -> untyped
660
660
 
661
661
  def sysread: (Integer maxlen, String outbuf) -> String
662
662
 
data/core/module.rbs CHANGED
@@ -90,7 +90,7 @@ class Module < Object
90
90
  # Returns `nil` if `module` has no relationship with `other_module`, if
91
91
  # `other_module` is not a module, or if the two values are incomparable.
92
92
  #
93
- def <=>: (Module other) -> Integer?
93
+ def <=>: (untyped other) -> Integer?
94
94
 
95
95
  # Equality --- At the Object level, #== returns `true` only if `obj` and `other`
96
96
  # are the same object. Typically, this method is overridden in descendant
@@ -158,7 +158,7 @@ class Module < Object
158
158
  #
159
159
  # Exiting with code 99
160
160
  #
161
- def alias_method: (Symbol new_name, Symbol old_name) -> self
161
+ def alias_method: (::Symbol | ::String new_name, ::Symbol | ::String old_name) -> ::Symbol
162
162
 
163
163
  # Returns a list of modules included/prepended in *mod* (including *mod*
164
164
  # itself).
data/core/numeric.rbs CHANGED
@@ -82,10 +82,20 @@ class Numeric
82
82
  #
83
83
  def %: (Numeric) -> Numeric
84
84
 
85
+ # Performs addition: the class of the resulting object depends on the class of
86
+ # `numeric`.
87
+ #
88
+ def +: (Numeric) -> Numeric
89
+
85
90
  # Unary Plus---Returns the receiver.
86
91
  #
87
92
  def +@: () -> Numeric
88
93
 
94
+ # Performs subtraction: the class of the resulting object depends on the class
95
+ # of `numeric`.
96
+ #
97
+ def -: (Numeric) -> Numeric
98
+
89
99
  # Unary Minus---Returns the receiver, negated.
90
100
  #
91
101
  def -@: () -> Numeric
data/core/proc.rbs CHANGED
@@ -262,7 +262,7 @@ class Proc < Object
262
262
 
263
263
  def []: (*untyped arg0) -> untyped
264
264
 
265
- def curry: (?Integer arity) -> Proc
265
+ def curry: (?_ToInt arity) -> Proc
266
266
 
267
267
  # Returns a hash value corresponding to proc body.
268
268
  #