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

Docs

XO0601: name does not resolve

error · reported by the checker

A variable, function, type, field, method, module, or effect name does not exist where it is used. The diagnostic suggests the nearest real names, so an API cannot be hallucinated silently. It also covers os, expect, and testing outside tests, a tuple field out of range, and result outside an ensures clause. Float.from(n) and other unknown associated functions of a numeric type called with one numeric argument get the fix Float(n): numeric conversions are calls on the type name (std.md 2.1). A print function of another language (println, print, fmt.Println, console.log) is this error too, because Xo prints through the Stdio capability: fn main(os: Os) and os.stdio.println("..."), or a stdio: Stdio parameter in another function; dbg(x) prints while debugging. See core 4.3. Coming from Go: knowledgebase/guides/option-result-for-go.md maps if err != nil, v, ok := m[k], error wrapping, and errors.Is to Xo (https://github.com/xo-lang/xo/blob/main/knowledgebase/guides/option-result-for-go.md).

Example

fn f() -> Int {
  let count = 1
  coutn
}

Fix

fn f() -> Int {
  let count = 1
  count
}

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