Skip to main content

Module oracle

Module oracle 

Source
Expand description

The differential oracle’s comparison (#3243, #1523 S2).

The language server is to reuse per-file analysis work between edits (a memo table, crate::memo). The one property that must never break is that a reused round answers exactly what a fresh round answers: a stale diagnostic is the failure mode of every incremental scheme. This module is what the CI oracle compares: canonical_report renders everything a ProjectAnalysis says into one deterministic string, so two analyses are equal exactly when their reports are.

Deterministic means independent of everything that is not meaning:

  • hash-map iteration order: maps are walked in sorted key order;
  • TyIds, which are indices into one analysis’s own interner and differ between two analyses of the same project: types are rendered structurally through each analysis’s own table (Types::display), never by id.

What it deliberately does not compare is memory identity (Arc pointers) or timing. Fields whose Debug output contains a hash map (the sequence and boundary tables) are compared through their sorted keys and the sorted debug of each entry, one level deep; the checker’s own results (diagnostics, index, hints, locals, requirements, expression types, capability paths, contract diff) are compared in full.

Functions§

canonical_report
One deterministic rendering of everything analysis says. See the module doc.