frontend: provide contextual source repair advice

This commit is contained in:
dev committed 2026-10-09 14:04:40 +03:00
1 parent 008867fe48
commit 2c6c7a3dcd
37 files changed
+562 -24

No files matched your search

@@ -45,7 +45,7 @@ Example:
## 3. Repair candidates
The compiler may emit structured suggestions:
The compiler MAY emit structured suggestions. The following kinds are illustrative:
```json
{
@@ -58,6 +58,10 @@ The compiler may emit structured suggestions:
Suggestions never modify semantics automatically.
Each `repair_candidates` element MUST have string `kind`; it MAY additionally have string `hint` and a nonempty ordered array of strings `alternatives`. Serialization order MUST be `kind`, then `hint`, then `alternatives`; absent optional members MUST be omitted. Existing kind-only objects remain valid. Alternatives are spellings for the construct/unit registered for that kind, not byte edits or a claim that the repaired program verifies. Their order MUST be deterministic and implies no preference. In particular, choosing a checked versus wrapping cast remains the agent's semantic decision. Agents MUST select advice by `kind`, not by parsing `hint` or `message`.
Source advice kinds, fixed hints, applicability and alternative units are registered in `reference/error-codes.md`. An E7001/E7005 diagnostic MUST NOT carry more than one registered source advice candidate; when a registered trigger applies, it MUST carry exactly that candidate. Advice MUST come from the rejecting parser/type rule, MUST NOT change accepted syntax or inference, and MUST preserve the existing code, location, payload and message. Imported source and formatter syntax failures MUST carry the same applicable advice; E7900 replacement MUST discard it.
## 4. ajid
`ajid` is the long-running machine interface.