Issue #1650: A package carries its cycle summaries, so calls into it are judged, not refused

Open and answer this issue on GitHub.

compiler, ready · opened 2026-11-15 · updated 2026-11-15 · 0 comments

Part of #1626. Step 5 of 5 of ADR-shared-handle-cycles-1. It rests on #1648 (function summaries) and #1649 (back fields).

Goal

After #1648, a call into another package has no summary, so it is judged conservatively: the result may reach every argument, and every self-reaching argument may be stored into. Correct programs that use a package’s handle types are then refused. With this issue, each package writes the summaries of its public functions into its interface, and a program that uses the package reads them.

Governing decision

Probe (to run after #1649)

A package nodes with pub fn fresh(name: String) -> SharedMut[Node] and pub fn link(from: SharedMut[Node], to: SharedMut[Node]), as in #1648’s probe, and a program in another package:

use nodes.{fresh, link}

fn main() throws {
	let a = fresh("a")
	let b = fresh("b")
	link(a, b)
	print("linked")
}

Done when

The probe compiles, the refusing variant is refused, the tests below pass, and measurement 5 of #1626 §9 is posted with the package part.

To build

  1. Write each public function’s summary, and each proved back field, into the package interface. Use the place where the interface already carries what callers need (the same file and format as the other entries; no second file). A summary names parameters by position and fields by name, so it does not depend on the package’s private names.
  2. Read them when a program calls into the package, in check_cycles.nika, in place of the conservative summary.
  3. Version: an interface without summaries keeps the conservative path. The interface’s format version changes only if the format needs it.
  4. Tests (a package’s tests, or tests/compiler/tests/ with a package beside it, whichever form the other cross-package tests use):
    • a_call_into_a_package_uses_its_cycle_summary (the probe, .stdout);
    • a_cycle_closed_through_a_package_function_is_refused (.stderr);
    • a_package_without_summaries_is_judged_conservatively (.stderr);
    • a_back_field_proved_in_a_package_holds_in_the_program (.stdout).
  5. Measurement 5, the package part: over packages/ and examples/, refusals for unknown: package before and after.

Files and limits

Ruled out

Back to Open Issues