E1033

E1033#

The import value is never used directly.

In MoonBit, you can import a value (say f) from another package into current package, so that you don't have to use @pkg.f to qualify the value, and you can just use f as if it were defined in this package. However, if f is not used in current package, this warning will be emitted.

Erroneous example#

lib/moon.pkg.json:

{}

lib/main.mbt:

pub fn greeting() -> String {
  "Hello, world!"
}

main/moon.pkg.json:

{
  "is-main": true,
  "import": [
    {
      "path": "username/hello/lib",
      "alias": "hello",
      "value": [
        "greeting" // Warning: The import value greeting is never used directly.
      ]
    }
  ]
}

main/main.mbt:

fn main {
  println(@hello.greeting())
}

Suggestion#

It is possible that you still use qualified name to access the imported value. In this case, either remove the imported value from moon.pkg.json.

main/moon.pkg.json:

{
  // ...
  "import": [
    {
      "path": "username/hello/lib",
      "alias": "hello"
    }
  ]
}

Or remove the qualified package name from your code:

main/main.mbt:

fn main {
  println(greeting())
}