Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · XO0537

Docs

XO0537: retired: a by value receiver read before an argument that changes it

warning · reported by the vet

xo vet used to report x.m(x.n(..)) where m takes x by value and n is a var method of x, because the call read x before n ran. Decision 0326 made the receiver read after the arguments (as a var receiver always was, decision 0142), so the check was removed. The code stays reserved. See the gotcha receiver-read-before-args.

Example

fn size_of(var t: Table, v: Int) -> Int {
  t.size(t.add(v))
}

Fix

// no change needed: size sees the item add pushed

Run xo explain XO0537 for this text in a terminal, or see section 10.6 of the specification.