Skip to content

Commit d2aae37

Browse files
authored
Merge branch 'master' into vpellan/caller-locations-narrowing
2 parents 77f3fcf + 7cf6ea2 commit d2aae37

92 files changed

Lines changed: 3191 additions & 2183 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/bundle-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Ruby
1717
uses: ruby/setup-ruby@v1
1818
with:
19-
ruby-version: '4.0.0-preview2'
19+
ruby-version: '4.0'
2020

2121
- name: Set up git
2222
run: |

.github/workflows/c-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v6
1313
- uses: ruby/setup-ruby@v1
1414
with:
15-
ruby-version: "4.0.0-preview2"
15+
ruby-version: "4.0"
1616
bundler-cache: none
1717
- name: Set working directory as safe
1818
run: git config --global --add safe.directory $(pwd)

.github/workflows/comments.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ on:
1010
jobs:
1111
comments:
1212
runs-on: "ubuntu-latest"
13-
env:
14-
RUBY_COMMIT: v4.0.0-preview2
13+
# env:
14+
# RUBY_COMMIT: v4.0.0-preview2
1515
steps:
1616
- uses: actions/checkout@v6
1717
- uses: ruby/setup-ruby@v1
1818
with:
19-
ruby-version: "4.0.0-preview2"
19+
ruby-version: "4.0.0"
2020
bundler: none
2121
- name: Install dependencies
2222
run: |

.github/workflows/ruby.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
ruby: ['3.2', '3.3', '3.4', '4.0.0-preview2', head]
16+
ruby: ['3.2', '3.3', '3.4', '4.0', head]
1717
rubyopt: [""]
1818
job:
1919
- test
2020
include:
2121
- ruby: head
2222
job: stdlib_test rubocop
23-
- ruby: "4.0.0-preview2"
23+
- ruby: "4.0"
2424
job: stdlib_test
25-
- ruby: "4.0.0-preview2"
25+
- ruby: "4.0"
2626
job: test
2727
rubyopt: "--enable-frozen-string-literal"
28-
- ruby: "4.0.0-preview2"
28+
- ruby: "4.0"
2929
job: stdlib_test
3030
rubyopt: "--enable-frozen-string-literal"
31-
- ruby: "4.0.0-preview2"
31+
- ruby: "4.0"
3232
job: rubocop validate test_doc build test_generate_stdlib raap
33-
- ruby: "4.0.0-preview2"
33+
- ruby: "4.0"
3434
job: typecheck_test
3535
env:
3636
RANDOMIZE_STDLIB_TEST_ORDER: "true"
@@ -74,7 +74,7 @@ jobs:
7474
strategy:
7575
fail-fast: false
7676
matrix:
77-
ruby: ['4.0.0-preview2', head]
77+
ruby: ['4.0', head]
7878
steps:
7979
- uses: actions/checkout@v6
8080
- name: Install dependencies
@@ -100,4 +100,3 @@ jobs:
100100
run: |
101101
bin/setup
102102
- run: bundle exec rake clean compile_c99
103-

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ gem "json-schema"
1616
gem "goodcheck"
1717
gem 'digest'
1818
gem 'tempfile'
19-
gem "rdoc", "~> 6.16"
19+
gem "rdoc"
2020
gem "fileutils"
2121
gem "raap"
2222
gem "activesupport", "~> 7.0"
@@ -52,6 +52,7 @@ gem 'pstore'
5252

5353
group :minitest do
5454
gem "minitest"
55+
gem "minitest-mock"
5556
end
5657

5758
group :typecheck_test do

Gemfile.lock

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,34 @@ GEM
3333
base64 (0.3.0)
3434
benchmark (0.5.0)
3535
benchmark-ips (2.14.0)
36-
bigdecimal (3.3.1)
37-
concurrent-ruby (1.3.5)
36+
bigdecimal (4.0.1)
37+
concurrent-ruby (1.3.6)
3838
connection_pool (3.0.2)
3939
csv (3.3.5)
4040
dbm (1.1.0)
4141
diff-lcs (1.6.2)
4242
digest (3.2.1)
4343
drb (2.2.3)
44-
erb (6.0.0)
44+
erb (6.0.1)
4545
extconf_compile_commands_json (0.0.7)
46-
ffi (1.17.2)
46+
ffi (1.17.3)
4747
fileutils (1.8.0)
4848
goodcheck (3.1.0)
4949
marcel (>= 1.0, < 2.0)
5050
psych (>= 3.1, < 5.0)
5151
rainbow (>= 3.0, < 4.0)
5252
strong_json (>= 1.1, < 2.2)
53-
i18n (1.14.7)
53+
i18n (1.14.8)
5454
concurrent-ruby (~> 1.0)
55-
io-console (0.8.1)
56-
irb (1.15.3)
55+
io-console (0.8.2)
56+
irb (1.16.0)
5757
pp (>= 0.6.0)
5858
rdoc (>= 4.0.0)
5959
reline (>= 0.4.2)
60-
json (2.17.1)
61-
json-schema (6.0.0)
60+
json (2.18.0)
61+
json-schema (6.1.0)
6262
addressable (~> 2.8)
63-
bigdecimal (~> 3.1)
63+
bigdecimal (>= 3.1, < 5)
6464
language_server-protocol (3.17.0.5)
6565
lint_roller (1.1.0)
6666
listen (3.9.0)
@@ -70,14 +70,16 @@ GEM
7070
marcel (1.1.0)
7171
memory_profiler (1.1.0)
7272
mini_portile2 (2.8.9)
73-
minitest (5.26.2)
73+
minitest (6.0.1)
74+
prism (~> 1.5)
75+
minitest-mock (5.27.0)
7476
mutex_m (0.3.0)
7577
net-protocol (0.2.2)
7678
timeout
7779
net-smtp (0.5.1)
7880
net-protocol
7981
nkf (0.2.0)
80-
nokogiri (1.18.10)
82+
nokogiri (1.19.0)
8183
mini_portile2 (~> 2.8.2)
8284
racc (~> 1.4)
8385
ostruct (0.6.3)
@@ -89,23 +91,23 @@ GEM
8991
pp (0.6.3)
9092
prettyprint
9193
prettyprint (0.2.0)
92-
prism (1.6.0)
94+
prism (1.7.0)
9395
pstore (0.2.0)
9496
psych (4.0.6)
9597
stringio
96-
public_suffix (7.0.0)
98+
public_suffix (7.0.2)
9799
raap (1.3.0)
98100
rbs (~> 3.9.0)
99101
timeout (~> 0.4)
100102
racc (1.8.1)
101103
rainbow (3.1.1)
102104
rake (13.3.1)
103-
rake-compiler (1.3.0)
105+
rake-compiler (1.3.1)
104106
rake
105107
rb-fsevent (0.11.2)
106108
rb-inotify (0.11.1)
107109
ffi (~> 1.0)
108-
rdoc (6.17.0)
110+
rdoc (7.0.3)
109111
erb
110112
psych (>= 4.0.0)
111113
tsort
@@ -125,20 +127,20 @@ GEM
125127
diff-lcs (>= 1.2.0, < 2.0)
126128
rspec-support (~> 3.13.0)
127129
rspec-support (3.13.6)
128-
rubocop (1.81.7)
130+
rubocop (1.82.1)
129131
json (~> 2.3)
130132
language_server-protocol (~> 3.17.0.2)
131133
lint_roller (~> 1.1.0)
132134
parallel (~> 1.10)
133135
parser (>= 3.3.0.2)
134136
rainbow (>= 2.2.2, < 4.0)
135137
regexp_parser (>= 2.9.3, < 3.0)
136-
rubocop-ast (>= 1.47.1, < 2.0)
138+
rubocop-ast (>= 1.48.0, < 2.0)
137139
ruby-progressbar (~> 1.7)
138140
unicode-display_width (>= 2.4.0, < 4.0)
139-
rubocop-ast (1.48.0)
141+
rubocop-ast (1.49.0)
140142
parser (>= 3.3.7.2)
141-
prism (~> 1.4)
143+
prism (~> 1.7)
142144
rubocop-on-rbs (1.8.0)
143145
lint_roller (~> 1.1)
144146
rbs (~> 3.5)
@@ -169,21 +171,21 @@ GEM
169171
strscan (>= 1.0.0)
170172
terminal-table (>= 2, < 5)
171173
uri (>= 0.12.0)
172-
stringio (3.1.9)
174+
stringio (3.2.0)
173175
strong_json (2.1.2)
174-
strscan (3.1.5)
176+
strscan (3.1.6)
175177
tempfile (0.3.1)
176178
terminal-table (4.0.0)
177179
unicode-display_width (>= 1.1.1, < 4)
178-
test-unit (3.7.3)
180+
test-unit (3.7.7)
179181
power_assert
180-
timeout (0.5.0)
182+
timeout (0.6.0)
181183
tsort (0.2.0)
182184
tzinfo (2.0.6)
183185
concurrent-ruby (~> 1.0)
184186
unicode-display_width (3.2.0)
185187
unicode-emoji (~> 4.1)
186-
unicode-emoji (4.1.0)
188+
unicode-emoji (4.2.0)
187189
uri (1.1.1)
188190
zlib (3.2.2)
189191

@@ -207,6 +209,7 @@ DEPENDENCIES
207209
json-schema
208210
memory_profiler
209211
minitest
212+
minitest-mock
210213
mutex_m
211214
net-smtp
212215
nkf
@@ -217,7 +220,7 @@ DEPENDENCIES
217220
rake-compiler
218221
rbs!
219222
rbs-amber!
220-
rdoc (~> 6.16)
223+
rdoc
221224
rspec
222225
rubocop
223226
rubocop-on-rbs

bin/generate_docs.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
set -ex
44

55
if [ -z ${RUBY_COMMIT} ]; then
6-
RUBY_COMMIT=v`ruby -e 'puts RUBY_VERSION.gsub(".", "_")'`
6+
RUBY_COMMIT=v`ruby -e '
7+
case
8+
when RUBY_VERSION >= "4.0.0"
9+
puts RUBY_VERSION
10+
else
11+
puts RUBY_VERSION.gsub(".", "_")
12+
end
13+
'`
714
fi
815

916
if [ -z ${RBS_RDOC_BASE_DIR} ]; then

core/array.rbs

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ class Array[unchecked out Elem] < Object
12131213
# Returns the element from `self` found by a binary search, or `nil` if the
12141214
# search found no suitable element.
12151215
#
1216-
# See [Binary Searching](rdoc-ref:bsearch.rdoc).
1216+
# See [Binary Searching](rdoc-ref:language/bsearch.rdoc).
12171217
#
12181218
# Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
12191219
#
@@ -1229,7 +1229,7 @@ class Array[unchecked out Elem] < Object
12291229
# Returns the integer index of the element from `self` found by a binary search,
12301230
# or `nil` if the search found no suitable element.
12311231
#
1232-
# See [Binary Searching](rdoc-ref:bsearch.rdoc).
1232+
# See [Binary Searching](rdoc-ref:language/bsearch.rdoc).
12331233
#
12341234
# Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
12351235
#
@@ -2019,6 +2019,30 @@ class Array[unchecked out Elem] < Object
20192019
def filter!: () { (Elem item) -> boolish } -> self?
20202020
| () -> ::Enumerator[Elem, self?]
20212021

2022+
# <!--
2023+
# rdoc-file=array.c
2024+
# - find(if_none_proc = nil) {|element| ... } -> object or nil
2025+
# - find(if_none_proc = nil) -> enumerator
2026+
# -->
2027+
# Returns the first element for which the block returns a truthy value.
2028+
#
2029+
# With a block given, calls the block with successive elements of the array;
2030+
# returns the first element for which the block returns a truthy value:
2031+
#
2032+
# [1, 3, 5].find {|element| element > 2} # => 3
2033+
#
2034+
# If no such element is found, calls `if_none_proc` and returns its return
2035+
# value.
2036+
#
2037+
# [1, 3, 5].find(proc {-1}) {|element| element > 12} # => -1
2038+
#
2039+
# With no block given, returns an Enumerator.
2040+
#
2041+
def find: () { (Elem) -> boolish } -> Elem?
2042+
| () -> ::Enumerator[Elem, Elem?]
2043+
| [T] (Enumerable::_NotFound[T] ifnone) { (Elem) -> boolish } -> (Elem | T)
2044+
| [T] (Enumerable::_NotFound[T] ifnone) -> ::Enumerator[Elem, Elem | T]
2045+
20222046
# <!--
20232047
# rdoc-file=array.c
20242048
# - find_index(object) -> integer or nil
@@ -2618,7 +2642,7 @@ class Array[unchecked out Elem] < Object
26182642
# - pack(template, buffer: nil) -> string
26192643
# -->
26202644
# Formats each element in `self` into a binary string; returns that string. See
2621-
# [Packed Data](rdoc-ref:packed_data.rdoc).
2645+
# [Packed Data](rdoc-ref:language/packed_data.rdoc).
26222646
#
26232647
def pack: (string fmt, ?buffer: String?) -> String
26242648

@@ -2988,6 +3012,31 @@ class Array[unchecked out Elem] < Object
29883012
def reverse_each: () { (Elem item) -> void } -> self
29893013
| () -> ::Enumerator[Elem, self]
29903014

3015+
# <!--
3016+
# rdoc-file=array.c
3017+
# - rfind(if_none_proc = nil) {|element| ... } -> object or nil
3018+
# - rfind(if_none_proc = nil) -> enumerator
3019+
# -->
3020+
# Returns the last element for which the block returns a truthy value.
3021+
#
3022+
# With a block given, calls the block with successive elements of the array in
3023+
# reverse order; returns the first element for which the block returns a truthy
3024+
# value:
3025+
#
3026+
# [1, 2, 3, 4, 5, 6].rfind {|element| element < 5} # => 4
3027+
#
3028+
# If no such element is found, calls `if_none_proc` and returns its return
3029+
# value.
3030+
#
3031+
# [1, 2, 3, 4].rfind(proc {0}) {|element| element < -2} # => 0
3032+
#
3033+
# With no block given, returns an Enumerator.
3034+
#
3035+
def rfind: () { (Elem) -> boolish } -> Elem?
3036+
| () -> ::Enumerator[Elem, Elem?]
3037+
| [T] (Enumerable::_NotFound[T] ifnone) { (Elem) -> boolish } -> (Elem | T)
3038+
| [T] (Enumerable::_NotFound[T] ifnone) -> ::Enumerator[Elem, Elem | T]
3039+
29913040
# <!--
29923041
# rdoc-file=array.c
29933042
# - rindex(object) -> integer or nil

core/comparable.rbs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,26 @@
5555
module Comparable : _WithSpaceshipOperator
5656
# <!--
5757
# rdoc-file=compar.c
58-
# - obj < other -> true or false
58+
# - self < other -> true or false
5959
# -->
60-
# Compares two objects based on the receiver's `<=>` method, returning true if
61-
# it returns a value less than 0.
60+
# Returns whether `self` is "less than" `other`; equivalent to `(self <=> other)
61+
# < 0`:
62+
#
63+
# 'foo' < 'foo' # => false
64+
# 'foo' < 'food' # => true
6265
#
6366
def <: (untyped other) -> bool
6467

6568
# <!--
6669
# rdoc-file=compar.c
67-
# - obj <= other -> true or false
70+
# - self <= other -> true or false
6871
# -->
69-
# Compares two objects based on the receiver's `<=>` method, returning true if
70-
# it returns a value less than or equal to 0.
72+
# Returns whether `self` is "less than or equal to" `other`; equivalent to
73+
# `(self <=> other) <= 0`:
74+
#
75+
# 'foo' <= 'foo' # => true
76+
# 'foo' <= 'food' # => true
77+
# 'food' <= 'foo' # => false
7178
#
7279
def <=: (untyped other) -> bool
7380

0 commit comments

Comments
 (0)