Pular para o conteúdo
TE135 · Tipos · error

Nome desconhecido não tem binding nativo

Check exclusivo de native/LLVM: um identificador simples não resolveu para nada. Sem prelúdio Lua de fallback, ele viraria `nil` silenciosamente em runtime — a classe "typo vira no-op quieto" que isso pega em tempo de build.

Why this fires

This is a native/LLVM build-only check — it never fires on zolo run (the VM). A lowercase-initial bare identifier resolved to nothing: not a local/parameter/capture, not a top-level global or function, not an enum/struct/variant, not a codegen-resolved builtin, and not a VM-prelude declaration. On the native and LLVM backends there is no Lua prelude to fall back on, so an unresolved name would otherwise silently lower to nil at runtime — the exact "typo turns into a quiet no-op" class this check exists to catch at build time instead.

print(totally_unknown_fn)

Building this natively fails with:

error[TE135]: unknown name `totally_unknown_fn` — it resolves to nothing on the
native/LLVM backend (which has no Lua prelude), so it would silently evaluate to
nil at runtime. Check for a typo, define it, or bring it into scope with `use`.
(The VM's `zolo run` tolerates an undefined global as nil; the AOT backends
refuse to emit the silent nil.)

The same program runs fine on the VM (zolo run), printing nilTE135 exists precisely because that silent behavior is not acceptable once you build for native/LLVM.

Fix it

1. Fix the typo / define the name

fn totally_unknown_fn() -> str { return "hi" }
print(totally_unknown_fn())

2. Bring it into scope with use

If the name is meant to come from a module or plugin, import it explicitly:

use std::math
print(math.pi)

A use m::* glob import, or any use m::{name} import, suppresses this check for the names it could plausibly install at runtime — the compiler can't tell "genuinely missing" from "installed by the glob" in that case, so it stays permissive.

See also

  • TE134 — a name that DOES exist (in the VM prelude) but has no native bridge yet.
  • TE100 — the VM/typeck-side "undefined variable" check.

Veja também

Buscar no Zolo

9 resultados

en