~jojo/Carth

ref: 2219ea535f4a0fd0afd9000ba5c6918c6b276210 Carth/src/SrcPos.hs -rw-r--r-- 1.1 KiB
remove no longer applicable TODOs
Include macro expansion trace in SrcPos. Better err msgs!

    POS1: Error:
      CODE
    MESSAGE

    POS2: Note:
      CODE
    In expansion of macro.
Extract tests from CheckSpec to individual files in test/tests/bad

SystemSpec now runs those and verifies the type errors match what's expected
Change formatting: 90 cols, IndentPolicyFree, etc. Add brittany.yaml

Most people have pretty wide and high res screens at this point. I
can't fit two windows with 100 line length next to eachother with my
font size, but 90 works and most people have smaller font size than me
I think.

Also, change brittanys indentation policy to Free. This almost always
looks better. I just had to disable formatting of imports -- I don't
want to align those, but IndentationPolicyFree insists.

Finally, actually add a project-local brittany config file, so that
anyone (or me in the future / on another computer) can use the same
formatting rules.
Refactor global & let definitions

Instead of jumbling together function and var defs and just checking
which is which at the end in Codegen, treat them very separately and
remember the grouping for recursive defs.

For now, just moves around complexity really. I don't remember how
exactly, but I thought this would be necessary for the next feature,
which is allowing patterns in left hand side of var defs.
Refactor SrcPos a bit
Add rudimentary DWARF debugging

Can now view stacktrace with line numbers in GDB. Can step
line-by-line and see position in source with `gdb -tui` (although it's
somewhat crippled by not being statement-based like C etc).
Check user-written types in Infer

Basically, do `checkType` for user-written types. It detects
references to undefined types. Also, separete AnnotAst.Type from
Ast.Type to help enforce that this is done. This whole ordeal required
some refactoring.
Simplify error-region parsing in TypeErr using tokenTree everywhere
Match: Check for redundancy
`printErr : ... -> IO ()` to `prettyErr : ... -> Source -> String`

Instead of reading the source file (for the second time) via IO, pass
along the source we got in Main
Mark offending section of offending line in type errors

by applying the parser at the sourcepos of the item, and counting how
long the consumed input was to get the span of the item in the source.
Minor changes
Put SourcePos in newtype SrcPos
SourcePos -> SrcPos
Simplify representation of Pat

Improve how SourcePos is stored & remove unnecessary variant
Add pos to Id & add pos to error for conflicting var defs in pattern
Separate module SrcPos