rbs 1.0.4 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -2
- data/CHANGELOG.md +95 -0
- data/Rakefile +5 -2
- data/Steepfile +2 -0
- data/bin/rbs-prof +1 -1
- data/core/array.rbs +11 -7
- data/core/complex.rbs +1 -1
- data/core/enumerable.rbs +16 -2
- data/core/enumerator.rbs +4 -0
- data/core/file.rbs +2 -1
- data/core/hash.rbs +13 -5
- data/core/integer.rbs +2 -1
- data/core/io.rbs +3 -3
- data/core/module.rbs +2 -2
- data/core/numeric.rbs +10 -0
- data/core/proc.rbs +1 -1
- data/core/random.rbs +4 -2
- data/core/range.rbs +2 -2
- data/core/rational.rbs +2 -1
- data/core/string.rbs +2 -1
- data/core/struct.rbs +3 -2
- data/core/symbol.rbs +2 -1
- data/core/thread.rbs +15 -2
- data/core/time.rbs +2 -1
- data/docs/CONTRIBUTING.md +5 -3
- data/docs/sigs.md +18 -1
- data/docs/stdlib.md +1 -1
- data/docs/syntax.md +11 -11
- data/lib/rbs.rb +4 -0
- data/lib/rbs/ancestor_graph.rb +90 -0
- data/lib/rbs/ast/annotation.rb +2 -2
- data/lib/rbs/ast/comment.rb +2 -2
- data/lib/rbs/ast/declarations.rb +37 -22
- data/lib/rbs/ast/members.rb +39 -26
- data/lib/rbs/char_scanner.rb +20 -0
- data/lib/rbs/cli.rb +3 -0
- data/lib/rbs/constant_table.rb +4 -1
- data/lib/rbs/definition.rb +1 -1
- data/lib/rbs/definition_builder.rb +64 -25
- data/lib/rbs/definition_builder/ancestor_builder.rb +1 -0
- data/lib/rbs/definition_builder/method_builder.rb +27 -4
- data/lib/rbs/environment.rb +42 -5
- data/lib/rbs/environment_walker.rb +4 -4
- data/lib/rbs/errors.rb +32 -17
- data/lib/rbs/location.rb +106 -2
- data/lib/rbs/locator.rb +205 -0
- data/lib/rbs/method_type.rb +2 -2
- data/lib/rbs/parser.rb +1154 -796
- data/lib/rbs/parser.y +432 -87
- data/lib/rbs/test/hook.rb +8 -2
- data/lib/rbs/test/type_check.rb +7 -3
- data/lib/rbs/type_name.rb +2 -3
- data/lib/rbs/type_name_resolver.rb +1 -1
- data/lib/rbs/types.rb +36 -34
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +4 -2
- data/sig/ancestor_graph.rbs +40 -0
- data/sig/annotation.rbs +1 -1
- data/sig/char_scanner.rbs +9 -0
- data/sig/cli.rbs +31 -21
- data/sig/comment.rbs +1 -1
- data/sig/declarations.rbs +106 -21
- data/sig/definition_builder.rbs +5 -1
- data/sig/environment.rbs +24 -4
- data/sig/environment_walker.rbs +39 -0
- data/sig/errors.rbs +42 -17
- data/sig/location.rbs +84 -3
- data/sig/locator.rbs +44 -0
- data/sig/members.rbs +77 -11
- data/sig/method_builder.rbs +3 -1
- data/sig/method_types.rbs +1 -1
- data/sig/parser.rbs +11 -4
- data/sig/polyfill.rbs +13 -22
- data/sig/rbs.rbs +8 -4
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +67 -20
- data/sig/util.rbs +0 -4
- data/sig/writer.rbs +8 -2
- data/stdlib/bigdecimal/0/big_decimal.rbs +1 -1
- data/stdlib/cgi/0/core.rbs +595 -0
- data/stdlib/date/0/date.rbs +1 -1
- data/stdlib/json/0/json.rbs +288 -0
- data/stdlib/pathname/0/pathname.rbs +2 -1
- data/stdlib/rubygems/0/basic_specification.rbs +3 -0
- data/stdlib/rubygems/0/config_file.rbs +3 -0
- data/stdlib/rubygems/0/dependency_installer.rbs +5 -0
- data/stdlib/rubygems/0/installer.rbs +3 -0
- data/stdlib/rubygems/0/path_support.rbs +3 -0
- data/stdlib/rubygems/0/platform.rbs +3 -0
- data/stdlib/rubygems/0/request_set.rbs +7 -0
- data/stdlib/rubygems/0/requirement.rbs +85 -0
- data/stdlib/rubygems/0/rubygems.rbs +710 -0
- data/stdlib/rubygems/0/source_list.rbs +2 -0
- data/stdlib/rubygems/0/specification.rbs +3 -0
- data/stdlib/rubygems/0/stream_ui.rbs +3 -0
- data/stdlib/rubygems/0/uninstaller.rbs +3 -0
- data/stdlib/rubygems/0/version.rbs +229 -0
- data/stdlib/set/0/set.rbs +7 -0
- data/stdlib/shellwords/0/shellwords.rbs +252 -0
- data/stdlib/strscan/0/string_scanner.rbs +582 -0
- data/stdlib/timeout/0/timeout.rbs +57 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +144 -7
- data/steep/Gemfile.lock +22 -21
- metadata +27 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3be8bb7e853829dddbff29b1a3337a33fd61e2860f6c83771dfdbe2ad097eb75
|
4
|
+
data.tar.gz: e569b69fe73f92c80e621521be85e8292fdb43a14d4f1fdc8f7537cdd04efbb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53895724feba94cfc7695ee7013f7cfa83618d566f4eec14fab0b5bed00074cda0394668a92d1f9eaa572bc3f0d8099a2f0bf201b05a444b3b2b8201c797ed48
|
7
|
+
data.tar.gz: 924a8b04e9b88464b5443fc1b8269cd20cfbfb25e04cc93737d52bbe1b4a895ac389371e373129ac6238a1152369ce71c3cca9183608fc9cebca4f571effc018
|
data/.github/workflows/ruby.yml
CHANGED
@@ -27,10 +27,10 @@ jobs:
|
|
27
27
|
run: |
|
28
28
|
apt-get update
|
29
29
|
apt-get install -y libdb-dev
|
30
|
-
- name:
|
30
|
+
- name: Update rubygems & bundler
|
31
31
|
run: |
|
32
32
|
ruby -v
|
33
|
-
gem
|
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
data/bin/rbs-prof
CHANGED
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) ->
|
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:
|
1588
|
-
| (?int n, ?random:
|
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:
|
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:
|
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
|
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
|
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
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
|
-
| (
|
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
|
-
|
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
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: () ->
|
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 } ->
|
502
|
-
| () -> ::Enumerator[[ K, V ],
|
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) ->
|
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: () ->
|
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 <=>: (
|
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=: (
|
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) ->
|
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) ->
|
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 <=>: (
|
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) ->
|
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
|