Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 418
    • Issues 418
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Merge requests
  • !633

FIX & FEAT: Keep column info throughout typecheck phase & add end column for improved error messaging

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Luuk Kablan requested to merge LuckyLuuk/sac2c:luukk/error-end-column into develop Mar 27, 2026
  • Overview 20
  • Commits 14
  • Pipelines 0
  • Changes 35

This merge requests fixes the issue that column info was lost in basically all code during the typecheck phase, it mostly swapped LINE_TO_LOC with NODE_LOCATION where possible. A size_t end_col was also added to the struct location to include the end of token when possible for improved error messaging, some error printing functions also have been changed to show it like <file>:<line>:<col>-<end_col>:<severity> <message> when possible with tildes (~) under the code from col to end_col.

I also wrote code to properly compute function-call end_col in ct_fun.c#269, this line would cause compiler crashes if NODE_LOCATION(fundef) was used and using it on assign would show incorrect column range which was the most important location for most common errors to include the col and end_col data.

Note that there are quite some changes that have nothing to do with token location at all, apparently much code wasn't formatted and when I saved the files I worked in, VSCode would automatically format according to the .clang-format provided in the root of the repository.

Edited Apr 09, 2026 by Luuk Kablan
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: luukk/error-end-column