Skip to content

Defer inside a for loop causes early exit #1849

Description

@xiaq

What happened, and what did you expect to happen?

This is unexpected:

for v [a b c] {
  defer { put defered }
  put $v
}
▶ a
▶ defered

Output of "elvish -version"

0.22.0-dev.0.20241002144851-c20fac4126aa-dirty

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    🧭Recon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions