Project

General

Profile

Actions

Bug #22004

open

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

Added by Earlopain (Earlopain _) about 19 hours ago.

Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.1.0dev (2026-04-15T13:47:25Z master d077df24a2) +PRISM [x86_64-linux]
[ruby-core:125279]

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.

No data to display

Actions

Also available in: PDF Atom