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

Docs

XO0535: `.debug()` inside an interpolation

note · reported by the vet

Reported by xo vet, not xo check. ${expr:?} interpolates the Debug text of expr, the same text as expr.debug(), so ${xs.debug()} is ${xs:?}. The diagnostic carries the fix (in xo vet --json), which replaces .debug() with :?. A type’s own debug method is left alone. See core 1.6 and decision 0296.

Example

fn show(xs: List[Int]) -> Str {
  "items ${xs.debug()}"
}

Fix

fn show(xs: List[Int]) -> Str {
  "items ${xs:?}"
}

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