Diagnostics#
Reporting#
--diagnostics#
--diagnostics text, --diagnostics json
--diagnostics chooses how compile and dump-ast write their diagnostics to stderr: text, the default, renders them for a person, and json writes one document.
The format moves no exit code.
(Spec: [RCLI.3.2])
Multiple errors#
A compile reports every error it finds within one stage of analysis, each as a separate diagnostic.
It may stop before a later stage once an earlier stage has failed.
(Spec: [RCLI.5.3])
Diagnostic codes#
Every DS_VALIDATE_* code a compiler emits is allocated in the registry specs/registry/validate.ebnf, and is matched by name.
The code’s number is a registry key and never leaves a compiler. A code keeps its name and is never reused.
Lexer errors#
A lexer error is reported with its position and kind; recovery after it is implementation-defined.
(Spec: [LLEX.15.3.1])
The JSON form#
JSON document#
{"diagnostics": [ <diagnostic>... ]}
Under json, the compiler writes one document whenever it reports a diagnostic, holding every diagnostic the text form would render, in that order.
A refused program’s errors and an accepted program’s warnings are both reported. When the compiler reports none, it writes no document. A usage error and an internal compiler error are no diagnostics of the program, so the document carries neither, and a compiler that exits 3 writes none. Every object admits no other member.
(Spec: [RCLI.3.2], Source: compiler/dsc_diagnostics.schema.json)
Diagnostic object#
Member |
Type |
Required |
Meaning |
|---|---|---|---|
|
string |
yes |
the code by name, matching |
|
|
yes |
|
|
string |
yes |
wording, which a compiler may change |
|
non-empty string |
no |
wording, absent when there is none |
|
span |
yes |
where the diagnostic points |
|
array of |
yes |
further locations, in the order named; empty when there are none |
A reader keys on code and span.
(Spec: [RCLI.3.2], Source: compiler/dsc_diagnostics.schema.json)
Span#
Member |
Type |
Meaning |
|---|---|---|
|
string |
the name the compiler gives the source |
|
|
the range’s first code point |
|
|
the position after its last |
line is 1-based, and column is 1-based in Unicode code points. A dump-ast node’s col_offset is one less than the column of the same point.
(Spec: [RCLI.1.10], [RCLI.3.2], Source: compiler/dsc_diagnostics.schema.json)
Catalogue#
Diagnostic catalogue#
Code |
Number |
Raised by |
|---|---|---|
|
1000 |
|
|
1001 |
[LOPQ.2.3] |
|
1002 |
[LLEX.9.7] |
|
1004 |
[LLEX.9.7] |
|
1006 |
|
|
1007 |
|
|
1008 |
[LUNI.7.5] |
|
1009 |
[LRST.1.3] |
|
1010 |
|
|
1011 |
[LSCP.1.7] |
|
1012 |
|
|
1013 |
[LGRA.4.1] |
|
1100 |
[LADP.8.3.3], [LIMP.3.1.3] |
|
1101 |
|
|
1102 |
|
|
1103 |
|
|
1104 |
[LGRA.4.6], [LGRA.22.5], [LIMP.2.1.7], [LIMP.5.2.4], [LIMP.12.3] |
|
1105 |
|
|
1106 |
[LIMP.4.3.2], [LIMP.7.7] |
|
1107 |
|
|
1108 |
[LGRA.22.7], [LIMP.4.3.2] |
|
1109 |
|
|
1110 |
[LGRA.3.2] |
|
1111 |
|
|
1201 |
[NDLC.6.1] |
|
1202 |
|
|
1203 |
[NDLC.6.1] |
|
1205 |
|
|
1210 |
|
|
1214 |
|
|
1215 |
|
|
1216 |
|
|
1217 |
[LCAP.2.9], [LDIA.1.3], [LDIA.2.10.9], [LDIA.3.4.2], [LDTL.3.2], [LNOG.3.1], [LNOG.3.2], [LNRE.1.3], [LNRE.3.1], [LNRE.5], [NDLC.5.3], [NDLC.8.1] |
|
1218 |
[LDIA.2.10.6], [LTSL.2.1] |
|
1219 |
|
|
1220 |
|
|
1221 |
|
|
1222 |
[LCAP.2.10], [LDIA.3.3.7], [NDLC.6.1] |
|
1300 |
|
|
1301 |
[LLEX.9.7], [LSER.6.6.1] |
|
1303 |
|
|
1304 |
|
|
1306 |
|
|
1307 |
|
|
1309 |
|
|
1311 |
[LGRA.22.4.1], [LIMP.4.3.2] |
|
1312 |
|
|
1313 |
|
|
1314 |
|
|
1315 |
|
|
1316 |
|
|
1317 |
|
|
1318 |
[LFAC.2.6.4], [LGRA.5.9.5] |
|
1319 |
|
|
1320 |
|
|
1321 |
[LSER.13.14], [LSTR.11.1] |
|
1322 |
|
|
1323 |
|
|
1324 |
|
|
1325 |
|
|
1713 |
|
|
1914 |
|
|
1400 |
[LRST.1.4] |
|
1401 |
[LRST.1.5], [LRST.1.5.1] |
|
1416 |
[LRST.1.2] |
|
1417 |
|
|
1402 |
[LINT.1.4] |
|
1404 |
|
|
1405 |
[LCST.4.1.5], [LCST.4.3.2], [LCST.4.5.11] |
|
1406 |
[LCST.4.1.6], [LCST.4.5.3], [LUNI.8.5] |
|
1407 |
|
|
1408 |
|
|
1410 |
[LDTL.4.1], [LNUL.5.1], [LRST.6.10], [LSTO.4.6.1] |
|
1411 |
[LADP.8.5.4], [LDTL.4.1], [LEXP.7.3b], [LEXP.7.12.5], [LGRA.2.8.11], [LGRA.13.8], [LINT.2.2], [LINT.3.1.3], [LINT.3.2.2], [LINT.4.2], [LINT.5.4], [LSTO.4.6.1], [LSTR.4.5], [LTIM.5.5] |
|
1412 |
[LGRA.5.7.1], [LGRA.23.2], [LUNI.8.6] |
|
1414 |
[LNUL.4.4] |
|
1415 |
[LERR.9.2] |
|
1500 |
[LEXP.3.1], [LEXP.10.2.4], [LSER.6.11.3] |
|
1501 |
[LEXP.7.1a], [LEXP.7.10], [LGRA.9.6.2], [LUNI.3.3] |
|
1502 |
[LGRA.5.7a.3], [LGRA.5.8.5] |
|
1503 |
[LEXP.7.7], [LEXP.7.9], [LTIM.1.3.5] |
|
1504 |
[LEXP.10.2.2], [LUNI.2.2] |
|
1505 |
[LUNI.4.5] |
|
1507 |
[LGRA.2.9.6.4], [LGRA.2.9.6.5] |
|
1508 |
[LGRA.2.9.6.7], [LGRA.2.9.6.9] |
|
1509 |
|
|
1519 |
|
|
1510 |
[LGRA.2.9.6.5], [LUNI.11.2] |
|
1511 |
|
|
1512 |
|
|
1513 |
[LEXP.7.8] |
|
1514 |
|
|
1515 |
[LGRA.9.8.11], [LGRA.22.7], [LIMP.3.3.4], [LSTR.9.6] |
|
1520 |
[LEXP.3.7.2], [LEXP.7.18], [LGRA.9.6.2], [LTIM.6.1] |
|
1521 |
|
|
1517 |
[LEXP.9.6.1], [LTIM.2.6.2] |
|
1523 |
|
|
1524 |
|
|
1600 |
[LGRA.2.8.11], [LLEX.12.8], [LTAC.2.2] |
|
1607 |
|
|
1608 |
[LADP.8.5.2], [LUNI.8.2], [LUNI.8.3], [LUNI.8.8], [LUNI.8.9] |
|
1615 |
[LUNI.4.3] |
|
1616 |
[LIMP.5.1.5], [LUNI.4.1.2] |
|
1617 |
|
|
1618 |
[LUNI.4.3] |
|
1619 |
[LUNI.4.5] |
|
1620 |
[LUNI.3.1.7], [LUNI.15.1] |
|
1622 |
[LUNI.4.3] |
|
1624 |
[LUNI.9.2] |
|
1625 |
[LGRA.2.9.6.5], [LUNI.3.1.5], [LUNI.14.9] |
|
1626 |
|
|
1627 |
|
|
1628 |
|
|
1629 |
[LUNI.4.3] |
|
1631 |
|
|
1700 |
[LGRA.4.1] |
|
1701 |
[LGRA.4.1] |
|
1702 |
[LEXP.8.8], [LEXP.8.8.2], [LTIM.14.3] |
|
1703 |
[LGRA.4.3] |
|
1704 |
|
|
1705 |
[LUNI.8.6] |
|
1706 |
[LUNI.8.6] |
|
1707 |
|
|
1708 |
|
|
1709 |
|
|
1710 |
|
|
1711 |
[LGRA.2.8.11], [LGRA.4.1], [LGRA.22.7] |
|
1712 |
[LUNI.8.6] |
|
1800 |
|
|
1802 |
|
|
1803 |
[LTHE.5.4] |
|
1805 |
[LTHE.4.9] |
|
1806 |
[LTHE.4.8] |
|
1808 |
[LCCO.6.2], [LCCO.8.4], [LGRA.13.8], [LGRA.22.7], [LLET.10.1] |
|
1809 |
|
|
1810 |
[LTHE.4.7], [LTIM.2.7.1] |
|
1811 |
[LINT.6.1] |
|
1812 |
[LINT.7.4] |
|
1813 |
[LINT.2.2] |
|
1814 |
[LINT.5.3] |
|
1815 |
[LINT.4.5] |
|
1816 |
|
|
1817 |
|
|
1818 |
[LTIM.6.2] |
|
1819 |
|
|
1820 |
[LGRA.8.6] |
|
1821 |
|
|
1822 |
|
|
1823 |
[LFAC.9.1] |
|
1824 |
[LFAC.9.3] |
|
1825 |
[LFAC.9.1] |
|
1826 |
[LGRA.8.6] |
|
1827 |
[LGRA.8.7] |
|
1828 |
|
|
1901 |
|
|
1902 |
[LCRS.8.1] |
|
1903 |
[LCYC.3.1], [LCYC.3.3.1], [LCYC.3.4.1], [LCYC.6.1.1], [LLOG.15.3], [RLOW.11.6] |
|
1904 |
[LCYC.3.4], [LCYC.3.4.1] |
|
1909 |
|
|
1911 |
[LCDB.7.9] |
|
1912 |
[LGRA.6.8] |
|
1913 |
[LCDB.5.5], [LGRA.6.6.7] |
|
2001 |
[LTAC.7.1] |
|
2002 |
[LCRS.6.3.3], [LGRA.10.3.4] |
|
2003 |
|
|
2004 |
|
|
2020 |
|
|
2005 |
[LADP.8.5.1], [LGRA.10.3.7], [LGRA.10.7] |
|
2008 |
[LECC.1.4] |
|
2026 |
[LECC.6.4] |
|
2009 |
[LADP.8.5.1], [LGRA.10.3.6] |
|
2010 |
[LDTL.4.1] |
|
2011 |
[LCRS.6.3.3], [LCRS.14.13] |
|
2012 |
|
|
2013 |
[LGRA.5.2] |
|
2015 |
[LADP.8.2.3], [LCRS.10.4.2], [RARC.9.3.4] |
|
2016 |
|
|
2022 |
|
|
2017 |
[LADP.8.6.1], [LGRA.23.2] |
|
2018 |
|
|
2019 |
|
|
2021 |
|
|
2024 |
|
|
2025 |
[LCCO.3.8] |
|
2200 |
|
|
2201 |
|
|
2202 |
[LSER.16.8.3], [LSIG.1.4.3], [LSMP.3.2a] |
|
2203 |
[LSER.17.3], [LSER.17.4], [LSER.17.5], [LSIG.1.4.3] |
|
2204 |
|
|
2205 |
|
|
2210 |
|
|
2211 |
|
|
2212 |
|
|
2214 |
[LSIG.3.3] |
|
2215 |
[LSIG.3.4] |
|
2216 |
|
|
2220 |
[LSER.14.4.5], [LSER.15.1], [LSER.15.2], [LSER.18.1] |
|
2221 |
[LSER.7.6.1], [LSER.10.13] |
|
2223 |
|
|
2224 |
|
|
2227 |
|
|
2229 |
|
|
2230 |
|
|
2231 |
[LNUL.8.6] |
|
2232 |
[LNUL.8.6] |
|
2233 |
[LNUL.8.6] |
|
2300 |
[LREG.4.2] |
|
2301 |
[LREG.2.5] |
|
2303 |
[LREG.3.3] |
|
2305 |
[LREG.4.5] |
|
2306 |
|
|
2307 |
[LREG.7.1] |
|
2308 |
[LREG.5.3] |
|
2309 |
[LREG.8.4] |
|
2310 |
|
|
2311 |
[LREG.4.1] |
|
2313 |
|
|
2400 |
|
|
2401 |
|
|
2402 |
|
|
2403 |
[LOPQ.2.3] |
|
2505 |
[LCST.4.5.2], [RLOW.1.6] |
|
2506 |
[LCAP.2.1.5], [LDIA.3.2.3], [LDIA.3.3.7], [NDLC.2.2], [NDLC.6.1], [RCLI.1.9] |
|
2600 |
[LTSL.3.7] |
|
2602 |
|
|
2603 |
[LTSL.3.2] |
|
2604 |
|
|
2605 |
|
|
2606 |
|
|
2607 |
|
|
2608 |
[LTSL.2.3] |
|
2609 |
[LTSL.2.3] |
|
2610 |
[LTSL.2.3] |
|
2611 |
[LTSL.8.2] |
|
2612 |
[LTSL.7.3] |
|
2613 |
[LTSL.7.5] |
|
2614 |
[LTSL.2.1] |
|
2615 |
[LTSL.8.4] |
|
2704 |
|
|
2705 |
[LCST.4.5.2], [LSTR.4.6] |
|
2706 |
|
|
2801 |
|
|
2802 |
|
|
2803 |
|
|
2804 |
[LNLS.3.9] |
|
2805 |
[LNLS.3.1] |
|
2807 |
[LNLS.3.2] |
|
2808 |
[LNLS.3.8] |
|
2809 |
|
|
2810 |
|
|
2811 |
[LREG.4.8] |
|
2906 |
|
|
3002 |
[LLOG.11.8], [LSCO.4.5.9] |
|
3003 |
|
|
3004 |
[LERR.9.4], [LSCP.2.6.1] |
|
3005 |
|
|
3101 |
|
|
3102 |
[LUNI.4.5] |
|
3103 |
[LADP.8.4.2], [LGRA.23.2] |
|
3104 |
|
|
3105 |
|
|
3106 |
|
|
3108 |
|
|
3109 |
[LTIE.4.9] |
(Spec: [RCLI.5.1], Source: specs/registry/validate.ebnf)