Skip to content

Commit fd97313

Browse files
committed
Merge remote-tracking branch 'gh/master' into zjit-polymorphic-getivar
2 parents 97c9a2e + 491e389 commit fd97313

47 files changed

Lines changed: 883 additions & 553 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/dependabot_automerge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
id: metadata
1818

1919
- name: Wait for status checks
20-
uses: lewagon/wait-on-check-action@3603e826ee561ea102b58accb5ea55a1a7482343 # v1.4.1
20+
uses: lewagon/wait-on-check-action@74049309dfeff245fe8009a0137eacf28136cb3c # v1.5.0
2121
with:
2222
repo-token: ${{ secrets.GITHUB_TOKEN }}
2323
ref: ${{ github.event.pull_request.head.sha || github.sha }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,8 @@ lcov*.info
278278
/bundled_gems.json
279279
/default_gems.json
280280
/gems/default_gems
281+
282+
# AI agents
283+
/.claude
284+
/AGENTS.md
285+
/CLAUDE.md

array.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8423,12 +8423,12 @@ rb_ary_deconstruct(VALUE ary)
84238423
*
84248424
* [1, 'one', :one, [2, 'two', :two]]
84258425
*
8426-
* - A {%w or %W string-array Literal}[rdoc-ref:syntax/literals.rdoc@25w+and+-25W-3A+String-Array+Literals]:
8426+
* - A {%w or %W string-array Literal}[rdoc-ref:syntax/literals.rdoc@w-and-w-String-Array-Literals]:
84278427
*
84288428
* %w[foo bar baz] # => ["foo", "bar", "baz"]
84298429
* %w[1 % *] # => ["1", "%", "*"]
84308430
*
8431-
* - A {%i or %I symbol-array Literal}[rdoc-ref:syntax/literals.rdoc@25i+and+-25I-3A+Symbol-Array+Literals]:
8431+
* - A {%i or %I symbol-array Literal}[rdoc-ref:syntax/literals.rdoc@i+and-I-Symbol-Array+Literals]:
84328432
*
84338433
* %i[foo bar baz] # => [:foo, :bar, :baz]
84348434
* %i[1 % *] # => [:"1", :%, :*]
@@ -8690,8 +8690,8 @@ rb_ary_deconstruct(VALUE ary)
86908690
*
86918691
* First, what's elsewhere. Class \Array:
86928692
*
8693-
* - Inherits from {class Object}[rdoc-ref:Object@What-27s+Here].
8694-
* - Includes {module Enumerable}[rdoc-ref:Enumerable@What-27s+Here],
8693+
* - Inherits from {class Object}[rdoc-ref:Object@Whats-Here].
8694+
* - Includes {module Enumerable}[rdoc-ref:Enumerable@Whats-Here],
86958695
* which provides dozens of additional methods.
86968696
*
86978697
* Here, class \Array provides methods that are useful for:

complex.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,9 +2645,9 @@ float_arg(VALUE self)
26452645
* First, what's elsewhere:
26462646
*
26472647
* - Class \Complex inherits (directly or indirectly)
2648-
* from classes {Numeric}[rdoc-ref:Numeric@What-27s+Here]
2649-
* and {Object}[rdoc-ref:Object@What-27s+Here].
2650-
* - Includes (indirectly) module {Comparable}[rdoc-ref:Comparable@What-27s+Here].
2648+
* from classes {Numeric}[rdoc-ref:Numeric@Whats-Here]
2649+
* and {Object}[rdoc-ref:Object@Whats-Here].
2650+
* - Includes (indirectly) module {Comparable}[rdoc-ref:Comparable@Whats-Here].
26512651
*
26522652
* Here, class \Complex has methods for:
26532653
*

dir.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# A \Dir object is in some ways array-like:
3232
#
3333
# - It has instance methods #children, #each, and #each_child.
34-
# - It includes {module Enumerable}[rdoc-ref:Enumerable@What-27s+Here].
34+
# - It includes {module Enumerable}[rdoc-ref:Enumerable@Whats+Here].
3535
#
3636
# == \Dir As Stream-Like
3737
#
@@ -85,8 +85,8 @@
8585
#
8686
# First, what's elsewhere. Class \Dir:
8787
#
88-
# - Inherits from {class Object}[rdoc-ref:Object@What-27s+Here].
89-
# - Includes {module Enumerable}[rdoc-ref:Enumerable@What-27s+Here],
88+
# - Inherits from {class Object}[rdoc-ref:Object@Whats+Here].
89+
# - Includes {module Enumerable}[rdoc-ref:Enumerable@Whats+Here],
9090
# which provides dozens of additional methods.
9191
#
9292
# Here, class \Dir provides methods that are useful for:

doc/float.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@
7272
# First, what's elsewhere. Class \Float:
7373
#
7474
# - Inherits from
75-
# {class Numeric}[rdoc-ref:Numeric@What-27s+Here]
76-
# and {class Object}[rdoc-ref:Object@What-27s+Here].
77-
# - Includes {module Comparable}[rdoc-ref:Comparable@What-27s+Here].
75+
# {class Numeric}[rdoc-ref:Numeric@Whats+Here]
76+
# and {class Object}[rdoc-ref:Object@Whats+Here].
77+
# - Includes {module Comparable}[rdoc-ref:Comparable@Whats+Here].
7878
#
7979
# Here, class \Float provides methods for:
8080
#

doc/string.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@
163163
#
164164
# First, what's elsewhere. Class +String+:
165165
#
166-
# - Inherits from the {Object class}[rdoc-ref:Object@What-27s+Here].
167-
# - Includes the {Comparable module}[rdoc-ref:Comparable@What-27s+Here].
166+
# - Inherits from the {Object class}[rdoc-ref:Object@Whats+Here].
167+
# - Includes the {Comparable module}[rdoc-ref:Comparable@Whats+Here].
168168
#
169169
# Here, class +String+ provides methods that are useful for:
170170
#

doc/syntax/literals.rdoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,13 @@ with <tt>%w</tt> (non-interpolable) or <tt>%W</tt> (interpolable):
547547
# (not nested array).
548548
%w[foo[bar baz]qux] # => ["foo[bar", "baz]qux"]
549549

550+
The interpolated string is treated as a single word even if it contains
551+
whitespace.
552+
553+
s = "bar baz"
554+
%W[foo #{s} zot] #=> ["foo", "bar baz", "zot"]
555+
%W[foo #{"bar baz zot"} qux] # => ["foo", "bar baz zot", "qux"]
556+
550557
The following characters are considered as white spaces to separate words:
551558

552559
* space, ASCII 20h (SPC)

eval.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -329,17 +329,24 @@ ruby_exec_node(void *n)
329329

330330
/*
331331
* call-seq:
332-
* Module.nesting -> array
333-
*
334-
* Returns the list of +Modules+ nested at the point of call.
332+
* Module.nesting -> array
333+
*
334+
* Returns nested module as an array of Module objects:
335+
*
336+
* module M0
337+
* def self.speak = Module.nesting
338+
* module M1
339+
* def self.speak = Module.nesting
340+
* module M2
341+
* def self.speak = Module.nesting
342+
* end
343+
* end
344+
* end
345+
* M0.speak # => [M0]
346+
* M0.speak.first.class # => Module
347+
* M0::M1.speak # => [M0::M1, M0]
348+
* M0::M1::M2.speak # => [M0::M1::M2, M0::M1, M0]
335349
*
336-
* module M1
337-
* module M2
338-
* $a = Module.nesting
339-
* end
340-
* end
341-
* $a #=> [M1::M2, M1]
342-
* $a[0].name #=> "M1::M2"
343350
*/
344351

345352
static VALUE

ext/coverage/coverage.c

Lines changed: 95 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -480,137 +480,139 @@ rb_coverage_running(VALUE klass)
480480
}
481481

482482
/* \Coverage provides coverage measurement feature for Ruby.
483-
* This feature is experimental, so these APIs may be changed in future.
484483
*
485-
* Caveat: Currently, only process-global coverage measurement is supported.
486-
* You cannot measure per-thread coverage.
484+
* Only process-global coverage measurement is supported, meaning
485+
* that coverage cannot be measure on a per-thread basis.
487486
*
488-
* = Usage
487+
* = Quick Start
489488
*
490-
* 1. require "coverage"
491-
* 2. do Coverage.start
492-
* 3. require or load Ruby source file
493-
* 4. Coverage.result will return a hash that contains filename as key and
494-
* coverage array as value. A coverage array gives, for each line, the
495-
* number of line execution by the interpreter. A +nil+ value means
496-
* coverage is disabled for this line (lines like +else+ and +end+).
489+
* 1. Load coverage using <tt>require "coverage"</tt>.
490+
* 2. Call Coverage.start to set up and begin coverage measurement.
491+
* 3. All Ruby code loaded following the call to Coverage.start will have
492+
* coverage measurement.
493+
* 4. Coverage results can be fetched by calling Coverage.result, which returns a
494+
* hash that contains filenames as the keys and coverage arrays as the values.
495+
* Each element of the coverage array gives the number of times each line was
496+
* executed. A +nil+ value means coverage was disabled for that line (e.g.
497+
* lines like +else+ and +end+).
497498
*
498499
* = Examples
499500
*
500-
* [foo.rb]
501-
* s = 0
502-
* 10.times do |x|
503-
* s += x
504-
* end
501+
* In file +fib.rb+:
505502
*
506-
* if s == 45
507-
* p :ok
508-
* else
509-
* p :ng
503+
* def fibonacci(n)
504+
* if n == 0
505+
* 0
506+
* elsif n == 1
507+
* 1
508+
* else
509+
* fibonacci(n - 1) + fibonacci(n - 2)
510+
* end
510511
* end
511-
* [EOF]
512+
*
513+
* puts fibonacci(10)
514+
*
515+
* In another file, coverage can be measured:
512516
*
513517
* require "coverage"
514518
* Coverage.start
515-
* require "foo.rb"
516-
* p Coverage.result #=> {"foo.rb"=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil]}
519+
* require "fib.rb"
520+
* Coverage.result # => {"fib.rb" => [1, 177, 34, 143, 55, nil, 88, nil, nil, nil, 1]}
517521
*
518522
* == Lines \Coverage
519523
*
520-
* If a coverage mode is not explicitly specified when starting coverage, lines
521-
* coverage is what will run. It reports the number of line executions for each
522-
* line.
524+
* Lines coverage reports the number of line executions for each line.
525+
* If the coverage mode is not explicitly specified when starting coverage,
526+
* lines coverage is used as the default.
523527
*
524528
* require "coverage"
525529
* Coverage.start(lines: true)
526-
* require "foo.rb"
527-
* p Coverage.result #=> {"foo.rb"=>{:lines=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil]}}
530+
* require "fib"
531+
* Coverage.result # => {"fib.rb" => {lines: [1, 177, 34, 143, 55, nil, 88, nil, nil, nil, 1]}}
528532
*
529-
* The value of the lines coverage result is an array containing how many times
530-
* each line was executed. Order in this array is important. For example, the
531-
* first item in this array, at index 0, reports how many times line 1 of this
532-
* file was executed while coverage was run (which, in this example, is one
533-
* time).
533+
* The returned hash differs depending on how Coverage.setup or Coverage.start
534+
* was executed.
535+
*
536+
* If Coverage.start or Coverage.setup was called with no arguments, it returns a
537+
* hash which contains filenames as the keys and coverage arrays as the values.
534538
*
535-
* A +nil+ value means coverage is disabled for this line (lines like +else+
536-
* and +end+).
539+
* If Coverage.start or Coverage.setup was called with <tt>line: true</tt>, it
540+
* returns a hash which contains filenames as the keys and hashes as the values.
541+
* The value hash has a key +:lines+ where the value is a coverage array.
542+
*
543+
* Each element of the coverage array gives the number of times the line was
544+
* executed. A +nil+ value in the coverage array means coverage was disabled
545+
* for that line (e.g. lines like +else+ and +end+).
537546
*
538547
* == Oneshot Lines \Coverage
539548
*
540-
* Oneshot lines coverage tracks and reports on the executed lines while
541-
* coverage is running. It will not report how many times a line was executed,
542-
* only that it was executed.
549+
* Oneshot lines coverage is similar to lines coverage, but instead of reporting
550+
* the number of times a line was executed, it only reports the lines that were
551+
* executed.
543552
*
544553
* require "coverage"
545554
* Coverage.start(oneshot_lines: true)
546-
* require "foo.rb"
547-
* p Coverage.result #=> {"foo.rb"=>{:oneshot_lines=>[1, 2, 3, 6, 7]}}
555+
* require "fib"
556+
* Coverage.result # => {"fib.rb" => {oneshot_lines: [1, 11, 2, 4, 7, 5, 3]}}
548557
*
549558
* The value of the oneshot lines coverage result is an array containing the
550559
* line numbers that were executed.
551560
*
552561
* == Branches \Coverage
553562
*
554-
* Branches coverage reports how many times each branch within each conditional
563+
* Branches coverage reports the number of times each branch within each conditional
555564
* was executed.
556565
*
557566
* require "coverage"
558567
* Coverage.start(branches: true)
559-
* require "foo.rb"
560-
* p Coverage.result #=> {"foo.rb"=>{:branches=>{[:if, 0, 6, 0, 10, 3]=>{[:then, 1, 7, 2, 7, 7]=>1, [:else, 2, 9, 2, 9, 7]=>0}}}}
568+
* require "fib"
569+
* Coverage.result
570+
* # => {"fib.rb" => {
571+
* # branches: {
572+
* # [:if, 0, 2, 2, 8, 5] => {
573+
* # [:then, 1, 3, 4, 3, 5] => 34,
574+
* # [:else, 2, 4, 2, 8, 5] => 143},
575+
* # [:if, 3, 4, 2, 8, 5] => {
576+
* # [:then, 4, 5, 4, 5, 5] => 55,
577+
* # [:else, 5, 7, 4, 7, 39] => 88}}}}
561578
*
562579
* Each entry within the branches hash is a conditional, the value of which is
563-
* another hash where each entry is a branch in that conditional. The values
564-
* are the number of times the method was executed, and the keys are identifying
565-
* information about the branch.
580+
* another hash where each entry is a branch in that conditional. The keys are
581+
* arrays containing information about the branch and the values are the number
582+
* of times the branch was executed.
566583
*
567-
* The information that makes up each key identifying branches or conditionals
568-
* is the following, from left to right:
584+
* The information that makes up the array that are the keys for conditional or
585+
* branches are the following, from left to right:
569586
*
570-
* 1. A label for the type of branch or conditional.
587+
* 1. A label for the type of branch or conditional (e.g. +:if+, +:then+, +:else+).
571588
* 2. A unique identifier.
572-
* 3. The starting line number it appears on in the file.
573-
* 4. The starting column number it appears on in the file.
574-
* 5. The ending line number it appears on in the file.
575-
* 6. The ending column number it appears on in the file.
589+
* 3. Starting line number.
590+
* 4. Starting column number.
591+
* 5. Ending line number.
592+
* 6. Ending column number.
576593
*
577594
* == Methods \Coverage
578595
*
579596
* Methods coverage reports how many times each method was executed.
580597
*
581-
* [foo_method.rb]
582-
* class Greeter
583-
* def greet
584-
* "welcome!"
585-
* end
586-
* end
587-
*
588-
* def hello
589-
* "Hi"
590-
* end
591-
*
592-
* hello()
593-
* Greeter.new.greet()
594-
* [EOF]
595-
*
596598
* require "coverage"
597599
* Coverage.start(methods: true)
598-
* require "foo_method.rb"
599-
* p Coverage.result #=> {"foo_method.rb"=>{:methods=>{[Object, :hello, 7, 0, 9, 3]=>1, [Greeter, :greet, 2, 2, 4, 5]=>1}}}
600+
* require "fib"
601+
* p Coverage.result #=> {"fib.rb" => {methods: {[Object, :fibonacci, 1, 0, 9, 3] => 177}}}
600602
*
601-
* Each entry within the methods hash represents a method. The values in this
602-
* hash are the number of times the method was executed, and the keys are
603+
* Each entry within the methods hash represents a method. The keys are arrays
604+
* containing hash are the number of times the method was executed, and the keys are
603605
* identifying information about the method.
604606
*
605607
* The information that makes up each key identifying a method is the following,
606608
* from left to right:
607609
*
608-
* 1. The class.
609-
* 2. The method name.
610-
* 3. The starting line number the method appears on in the file.
611-
* 4. The starting column number the method appears on in the file.
612-
* 5. The ending line number the method appears on in the file.
613-
* 6. The ending column number the method appears on in the file.
610+
* 1. Class that the method was defined in.
611+
* 2. Method name as a Symbol.
612+
* 3. Starting line number of the method.
613+
* 4. Starting column number of the method.
614+
* 5. Ending line number of the method.
615+
* 6. Ending column number of the method.
614616
*
615617
* == Eval \Coverage
616618
*
@@ -670,16 +672,24 @@ rb_coverage_running(VALUE klass)
670672
*
671673
* == All \Coverage Modes
672674
*
673-
* You can also run all modes of coverage simultaneously with this shortcut.
674-
* Note that running all coverage modes does not run both lines and oneshot
675-
* lines. Those modes cannot be run simultaneously. Lines coverage is run in
676-
* this case, because you can still use it to determine whether or not a line
677-
* was executed.
675+
* All modes of coverage can be enabled simultaneously using the Symbol +:all+.
676+
* However, note that this mode runs lines coverage and not oneshot lines since
677+
* they cannot be ran simultaneously.
678678
*
679679
* require "coverage"
680680
* Coverage.start(:all)
681-
* require "foo.rb"
682-
* p Coverage.result #=> {"foo.rb"=>{:lines=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil], :branches=>{[:if, 0, 6, 0, 10, 3]=>{[:then, 1, 7, 2, 7, 7]=>1, [:else, 2, 9, 2, 9, 7]=>0}}, :methods=>{}}}
681+
* require "fib"
682+
* Coverage.result
683+
* # => {"fib.rb" => {
684+
* # lines: [1, 177, 34, 143, 55, nil, 88, nil, nil, nil, 1],
685+
* # branches: {
686+
* # [:if, 0, 2, 2, 8, 5] => {
687+
* # [:then, 1, 3, 4, 3, 5] => 34,
688+
* # [:else, 2, 4, 2, 8, 5] => 143},
689+
* # [:if, 3, 4, 2, 8, 5] => {
690+
* # [:then, 4, 5, 4, 5, 5] => 55,
691+
* # [:else, 5, 7, 4, 7, 39] => 88}}}},
692+
* # methods: {[Object, :fibonacci, 1, 0, 9, 3] => 177}}}
683693
*/
684694
void
685695
Init_coverage(void)

0 commit comments

Comments
 (0)