Diagnostics and correction
ASPL 0.7.0 · Current release
Diagnostics, source spans, correction, and distinct failure outcomes.
On this page
Diagnostic record
A diagnostic carries a stable reason key, severity, typed arguments, a primary span, ordered secondary spans, and an optional edit. Language changes wording only. Technical type names, operators, bounds, and values stay full-width ASCII. Warnings do not block execution. Direct execution maps a diagnostic to source. Built programs contain no source map, but report the trapping function name and relative instruction index. The first example assigns an immutable binding. The correction replaces دع / let with متغير / var and normally returns status 1.
Source span and correction
Select a diagnostic to locate it in the checked source snapshot. Transport spans are half-open UTF-8 byte offsets, and the editor selects logical source. A diagnostic may include a proposed edit. In the immutable-binding example the primary span locates the assigned identifier, secondary spans are empty, and no automatic edit is supplied. Manually replace دع / let with متغير / var. Other diagnostics can include ordered secondary spans. Applying a correction and checking again does not run the program. Corrected source succeeds with status 1 and no output.
For an automatic correction, unsafe print("text") produces unsafe-on-safe-call with a removal edit for the unsafe marker. Apply that edit explicitly, then check again. The primary span locates the marker and the replacement is empty.
Execution: Browser and native · ASPL 0.7.0
- No prior knowledge is required to open and check it.
Input: No input lines are required.
fn start_main() -> i64 {
let value = 0;
value = 1;
return value;
}
Expected outcomes
{
"browser": {
"check": "source-error",
"class": "source-error",
"output": "",
"reason": "immutable-assignment"
},
"native": {
"check": 1,
"status": 1,
"output": "",
"reason": "immutable-assignment"
}
}Execution: Browser and native · ASPL 0.7.0
- No prior knowledge is required to open and check it.
Input: No input lines are required.
fn start_main() -> i64 {
var value = 0;
value = 1;
return value;
}
Expected outcomes
{
"browser": {
"check": "success",
"class": "success",
"output": "",
"processStatus": 1
},
"native": {
"check": 0,
"status": 1,
"output": ""
}
}Distinct outcomes
The example let byte: u8 = 256 is a checking error because the contextual literal is out of range. In contrast, u8(256) has a valid default i64 operand and traps with invalid-numeric-conversion only if reached. parse_u8("256") returns a failed result with code number-out-of-range. None of these outcomes becomes another.
A source error prevents compilation. A warning permits it. A failed result<T> is a value the program can inspect. A trap stops the whole program and cannot be caught. Load failure precedes execution. limit-stop, cancelled, and host-failure are separate outcomes. success with status 1 is language success, even when a shell treats it as nonzero.
Numeric technical fields
The integer numeric-literal-out-of-range checking diagnostic fields are spelling, type, minimum, maximum. Its floating form has spelling, type, classification, where the classification is finite-overflow. numeric-operator-not-supported has operator, type.
Numeric trap fields are ordered: integer-overflow has type, operation, operand-count, operands; integer-zero-divisor has type, operation, dividend; invalid-shift-count has left-type, count-type, count, width; and invalid-numeric-conversion has source-type, target-type, classification, then source-value or source-bits. Unsigned values through full u64 travel without JavaScript-number rounding.
Release scope and related reading
This page describes ASPL 0.7.0. The linked MVP text is a historical record, not a complete description of current extensions.