Skip to content

s2c: errors in the Rust shape (vic Q-E1) - #30

Merged
vic merged 1 commit into
mainfrom
s2c-errors
Nov 9, 2026
Merged

vic merged 1 commit into
mainfrom
s2c-errors

Conversation

@vic

@vic vic commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Every s2c diagnostic now has this shape:

error[mismatch]: the value has the wrong type
  --> tests/s2/neg/mismatch.srs:3
    |
  3 |   val x: I64 = true
    |
    = expected: I64
    = found:    Bool
    = help: give a value of the expected type, or change the declared type
  • Each error kind has a named code, a title and a help line. This covers parse, names, facts, type level, types, flow and comptime errors (about 80 kinds).
  • Lines are numbered across the files, using Lex.lexFrom and Parse.sourceFrom with a line base per file, so a line names its file. s2c keeps each file's path, first line and text to print the source line.
  • A mismatch shows the reified expected and found types.
  • Every neg test in tests/s2/neg expects the error[code] and the exact --> file:line line of each error. The gate matches the location as a whole line, so :1 cannot match :12. Armed control: an expect with the wrong line fails.

Gate: 372 ok, 0 FAIL.

…e, expected/found, help); lines numbered across files; neg tests expect the code and the exact location
@vic
vic merged commit 9b5cc75 into main Nov 9, 2026
3 checks passed
@vic
vic deleted the s2c-errors branch November 17, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant