From: "kddnewton (Kevin Newton) via ruby-core" Date: 2024-05-03T12:23:51+00:00 Subject: [ruby-core:117758] [Ruby master Bug#20464] Redundant returns are unreachable in coverage Issue #20464 has been updated by kddnewton (Kevin Newton). It's a little different. In that one the issue is the parser, in this one the issue is the compiler. Even if the node isn't eliminated from the AST, there will still likely need to be a fix in the compiler. ---------------------------------------- Bug #20464: Redundant returns are unreachable in coverage https://bugs.ruby-lang.org/issues/20464#change-108166 * Author: kddnewton (Kevin Newton) * Status: Open * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- With the following code: ```ruby def meth_return(a) return if a return end ``` If you run coverage on it, it's not possible for it to hit line 3, because there isn't a line event, because the return node was eliminated from the AST before it was compiled. There is a `putnil` instruction, so it's possible for us to attach a line event for it, but the compiler doesn't today. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/