Sakura Lang

V8032 dependency_effects_exceeded

A dependency's declared ceiling (its [package] effects, recorded in sakura.lock) lists std effects that the consumer's line for it does not accept (RFC 0003 §5.1, experimental).

An error from the package phase. sakura explain V8032 prints this explanation offline.

A dependency's declared ceiling (its [package] effects, recorded in sakura.lock) lists std effects that the consumer's line for it does not accept (RFC 0003 §5.1, experimental). The effects on a [dependencies] line is what the consumer agrees the dependency, and everything it calls, may require; absent, it is [], so a dependency with any ceiling needs the line. A new version or an edited path dependency that widens its ceiling stops compiling here until the line is edited. The suggested fix rewrites the line with the dependency's ceiling; it is an authority change and never applied automatically.

Wrong:

[dependencies]
stamp = { path = "../stamp" }   # stamp declares effects = ["Clock"]

Fixed:

[dependencies]
stamp = { path = "../stamp", effects = ["Clock"] }

Wrong program

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

main.sak:

// RFC 0003 §5.1: a dependency whose ceiling the consumer's line does not accept is `V8032` at
// that line, with a suggested fix (an authority change) that adds `effects = ["Clock"]`.
import stamp/lib

pub fn main() -> Unit ! {Clock, Console} { Console.print("{lib.now()}") }

Open in playground

sakura.toml:

[package]
name = "billing"

[dependencies]
stamp = { path = "stamp" }

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

{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:1bd3cfe505f2d351",
  "code": "V8032",
  "severity": "error",
  "phase": "package",
  "message": "dependency `stamp` may require `Clock`: its ceiling is `effects = [\"Clock\"]`, and this line accepts `effects = []`",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": null,
  "spans": [
    {
      "uri": "file://$DIR/V8032_dependency_effects_exceeded/sakura.toml",
      "content_hash": "sha256:a3117e7f0ad4ff7c933bd2de3362c7ac5cb99d4bda7c6bf59e4ff50aae83681b",
      "start_byte": 43,
      "end_byte": 69,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V8032",
  "fixes": [
    {
      "id": "f:1bd3cfe505f2d351.0",
      "title": "accept `stamp`'s ceiling on this line",
      "applicability": "suggested",
      "impact": "authority_change",
      "edits": [
        {
          "span": {
            "uri": "file://$DIR/V8032_dependency_effects_exceeded/sakura.toml",
            "content_hash": "sha256:a3117e7f0ad4ff7c933bd2de3362c7ac5cb99d4bda7c6bf59e4ff50aae83681b",
            "start_byte": 43,
            "end_byte": 69,
            "role": "primary"
          },
          "replacement": "stamp = { path = \"stamp\", effects = [\"Clock\"] }"
        }
      ]
    }
  ]
}

Fixed program

No fixed program is checked in for this code yet; the explanation above describes the repair.

Edit on GitHub

Last updated

On this page