Skip to content

fix: assign bindings in irrefutable let-else or-patterns#338

Merged
ivov merged 2 commits into
mainfrom
fix-irrefutable-let-else-or-bindings
May 7, 2026
Merged

fix: assign bindings in irrefutable let-else or-patterns#338
ivov merged 2 commits into
mainfrom
fix-irrefutable-let-else-or-bindings

Conversation

@ivov
Copy link
Copy Markdown
Owner

@ivov ivov commented May 7, 2026

let else in combination with or-patterns with an irrefutable alternative now assign the subject to the bindings instead of leaving them at Go zero values. The whole let cannot fail, but the bindings still need to receive the value.

fn main() {
  let x | x = 42 else {
    return
  }
  fmt.Println(x)
}

Previously printed 0 but now prints 42.

@ivov ivov merged commit 6362b34 into main May 7, 2026
12 checks passed
@ivov ivov mentioned this pull request May 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Released in lisette-v0.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant