Skip to content

fix: capture mutable reads before later sibling setup runs#336

Merged
ivov merged 1 commit into
mainfrom
capture-mutable-reads-before-sibling-setup
May 7, 2026
Merged

fix: capture mutable reads before later sibling setup runs#336
ivov merged 1 commit into
mainfrom
capture-mutable-reads-before-sibling-setup

Conversation

@ivov
Copy link
Copy Markdown
Owner

@ivov ivov commented May 7, 2026

Sibling sub-expressions now evaluate left-to-right even when a later sibling needs a lowered setup that mutates state read by an earlier sibling. Previously, the later setup ran first and the earlier read observed the post-mutation value.

fn bump(mut xs: Slice<int>) -> Result<int, error> {
  xs[0] = 2
  Ok(0)
}

fn main() {
  let mut xs = [1]
  fmt.Println(xs[0], bump(xs).is_ok())
}

Previously printed 2 true; now prints 1 true.

@ivov ivov merged commit ead1048 into main May 7, 2026
6 of 12 checks passed
@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