[#102393] [Ruby master Feature#17608] Compact and sum in one step — sawadatsuyoshi@...

Issue #17608 has been reported by sawa (Tsuyoshi Sawada).

13 messages 2021/02/04

[#102438] [Ruby master Bug#17619] if false foo=42; end creates a foo local variable set to nil — pkmuldoon@...

Issue #17619 has been reported by pkmuldoon (Phil Muldoon).

10 messages 2021/02/10

[#102631] [Ruby master Feature#17660] Expose information about which basic methods have been redefined — tenderlove@...

Issue #17660 has been reported by tenderlovemaking (Aaron Patterson).

9 messages 2021/02/27

[#102639] [Ruby master Misc#17662] The herdoc pattern used in tests does not syntax highlight correctly in many editors — eregontp@...

Issue #17662 has been reported by Eregon (Benoit Daloze).

13 messages 2021/02/27

[#102652] [Ruby master Bug#17664] Behavior of sockets changed in Ruby 3.0 to non-blocking — ciconia@...

Issue #17664 has been reported by ciconia (Sharon Rosner).

23 messages 2021/02/28

[ruby-core:102658] [Ruby master Bug#15980] Coverage shows while/until after raise if/unless as uncovered line

From: usa@...
Date: 2021-02-28 14:16:42 UTC
List: ruby-core #102658
Issue #15980 has been updated by usa (Usaku NAKAMURA).

Backport changed from 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: REQUIRED to 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: DONE

ruby_2_6 r67898 merged revision(s) f9e5c74c.

----------------------------------------
Bug #15980: Coverage shows while/until after raise if/unless as uncovered line
https://bugs.ruby-lang.org/issues/15980#change-90652

* Author: jeremyevans0 (Jeremy Evans)
* Status: Closed
* Priority: Normal
* Assignee: mame (Yusuke Endoh)
* ruby -v: ruby 2.7.0dev (2019-07-03) [x86_64-openbsd6.5]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: DONE
----------------------------------------
The following code shows line 2 (`while true`) as uncovered:

```ruby
raise if 1 == 2
while true
  break
end
```

Coverage reports the following for this file: `[1, 0, 1, nil]`.  Note that `true` isn't important, any `while` condition will work.  However, if you change line 1 to `raise if false`, line 1 shows `nil` coverage, and line 2 shows as covered (`[nil, 1, 1, nil]`).  That leads me to believe this issue is related to the optimizer.

I bisected this to commit:100bf2757468439106775a7d95a791a8c10b874a, which certainly appears related.

This is not a theoretical case, it affected three lines in Sequel.  While not a major problem, I do think a fix should be backported to 2.6.

Note that this only affects line coverage.  Branch coverage shows:

```ruby
{"file.rb"=>
  {:branches=>
    {[:if, 0, 1, 0, 1, 15]=>
      {[:then, 1, 1, 0, 1, 5]=>0, [:else, 2, 1, 0, 1, 15]=>1},
     [:while, 3, 2, 0, 4, 3]=>{[:body, 4, 3, 2, 3, 7]=>1}}}}
```

If you run with both branch and line coverage, line coverage shows correctly.

This affects `while`/`until` after a line with `raise ... if ...` or `raise ... unless ...`.  If you switch to `if ...; raise ...; end`, then line coverage shows correctly.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next