Issue #15476 has been reported by MaxLap (Maxime Lapointe).

----------------------------------------
Bug #15476: Branch coverage: Failing to load trivial sample when branch coverage is on
https://bugs.ruby-lang.org/issues/15476

* Author: MaxLap (Maxime Lapointe)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.0
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
The following will fail (for the second #load) on 2.6.0
I assume this is Ruby removing useless code, and the branch coverage code handling it incorrectly.

~~~ ruby
require 'tempfile'
f = Tempfile.new(['ruby', '.rb'])
f.write(<<-RUBY)
  nil&.map { |i| i }
RUBY
f.close

require 'coverage'

load f.path
puts 'Without coverage worked'
Coverage.start(branches: true)
load f.path
puts 'With coverage worked'
~~~

This problem was not present in 2.5, but appeared in 2.6




-- 
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>