Skip to content

Bug in UCS while loop that merge else branch #382

@AnsonYeung

Description

@AnsonYeung

Original code:

while f() is
  A() do ()
  B(xxx) do g(xxx)

When f return A(), the while loop terminates as the A() branch was merged with the else branch.

Full example to demonstrate that changing else branch affect the loop behaviour:

let x = 1
while x ===
  1 do
    set x = 2
  2 do
    set x = 3
    print("valid")
else
  set x = 2
print("not inf loop")
//│ > not inf loop
//│ x = 2

let x = 1
while x ===
  1 do
    set x = 2
  2 do
    set x = 3
    print("valid")
else
  set x = 3
print("not inf loop")
//│ > valid
//│ > not inf loop
//│ x = 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions