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

Docs

XO0427: xml.decode of a type parameter

error · reported by the checker

A call of xml.encode_value or xml.decode is compiled as a call of the function derive Xml generates for its struct, so the type must be known where it is called. Call it with the struct, or take the decoder as a function value. See core 2.9.

Example

fn read[T: Xml](s: Str) -> T ! xml.XmlErr {
  xml.decode[T](s)
}

Fix

fn read_item(s: Str) -> Item ! xml.XmlErr {
  xml.decode[Item](s)
}

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