Actions
Bug #22004
closedparse.y doesn't executes loop body with `while true || true` condition
Bug #22004:
parse.y doesn't executes loop body with `while true || true` condition
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 4.1.0dev (2026-04-15T13:47:25Z master d077df24a2) +PRISM [x86_64-linux]
Backport:
Description
while true || true
puts 1
end
This should never exit but with parse.y, the body is never executed. It seems to happen when one of the conditions is a truthy literal. Something similar happens with unitl:
until false && true
puts 1
end
By moving the literals out to methods that just return them, it behaves like I would expect. Seems to have started happening in Ruby 3.3.
Updated by nobu (Nobuyoshi Nakada) 11 days ago
- Status changed from Open to Closed
Applied in changeset git|7f4f3c8ee7cde795dc27be753796fc7ea8318565.
[Bug #22004] Fix short-circuited loop conditions
Updated by nagachika (Tomoyuki Chikanaga) 10 days ago
- Backport changed from 3.3: WONTFIX, 3.4: REQUIRED, 4.0: REQUIRED to 3.3: WONTFIX, 3.4: DONE, 4.0: REQUIRED
Backported into ruby_3_4 at fdac94eee1a3f226cafcfa6ec0da97bb08b03369
Updated by k0kubun (Takashi Kokubun) 3 days ago
- Backport changed from 3.3: WONTFIX, 3.4: DONE, 4.0: REQUIRED to 3.3: WONTFIX, 3.4: DONE, 4.0: DONE
ruby_4_0 b18acb27c3f1b1ae26bbae6e53e94e246dc0e973 merged revision(s) 7f4f3c8ee7cde795dc27be753796fc7ea8318565.
Actions