Sakura Lang

V1005 unresolved_module

An import names a module that does not exist in the snapshot, std, or the declared dependencies.

An error from the resolve phase. sakura explain V1005 prints this explanation offline.

An import names a module that does not exist in the snapshot, std, or the declared dependencies. The first path segment is a package name (std, this package, or a dependency); compiler/std/INDEX.md lists std's modules, and a dependency must be declared in sakura.toml.

Wrong:

import std/nope

Fixed:

import std/json

Wrong program

compiler/tests/ui/V1005_unresolved_module.sakura, which the compiler's ui suite runs through sakura check:

import std/nope

fn one() -> Int { 1 }

sakura check --json reports this record (pretty-printed; $DIR is the fixture's directory):

{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:0181cc0ea1827400",
  "code": "V1005",
  "severity": "error",
  "phase": "resolve",
  "message": "package `std` has no module `nope`",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": null,
  "spans": [
    {
      "uri": "file://$DIR/V1005_unresolved_module.sakura",
      "content_hash": "sha256:10af8eccdb2695bd7063b8495f5ba6de4e1ee9fca77baa73a4113509cb7396f6",
      "start_byte": 41,
      "end_byte": 49,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V1005",
  "fixes": []
}

Fixed program

compiler/tests/ui/V1005_unresolved_module.fixed.sakura, which sakura check accepts with no diagnostics:

import std/json

fn one() -> Int { 1 }
Edit on GitHub

On this page