E2002

E2002 — Undefined function

What the compiler reports

Error[E2002] at {{.*}}.vx:[[@LINE+1]]:3: Undefined function 'println'. To call the macro `println`, write `println!`{{$}}
Error[E2002] at {{.*}}.vx:[[@LINE+1]]:12: Undefined function 'vec'. To call the macro `vec`, write `vec!`{{$}}
Error[E2002] at {{.*}}.vx:[[@LINE+1]]:3: Undefined function 'printline'{{$}}

The fragments the test suite holds the compiler to. An ellipsis marks text the test does not constrain; the emitted message also carries a source location.

A program that triggers it

//
// Part of the Vx Project, under the Apache License v2.0 with LLVM Exceptions.
// See LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//
// `println` and `vec` are macros, so a call to one needs a `!`. A call without the `!` is
// a call to an undefined function (E2002), and the error says how to call the macro. A name
// that is not a macro gets only E2002.

fn main() -> i32 {
  println(1);
  let _v = vec(2);
  printline(3);
  return 0;
}

From tests/frontend/fail/macro_called_without_its_exclamation_mark.vx, which asserts this diagnostic on every commit.

Related