feat: improve semantic errors #15

Merged
gk1623 merged 5 commits from improve-semantic-errors into master 2025-02-07 15:07:36 +00:00
gk1623 commented 2025-02-07 14:24:35 +00:00 (Migrated from gitlab.doc.ic.ac.uk)
  • TypeMismatch errors will now show the expected type, and what was found ("Got")
  • When type-checking arrays and function params, use foldLeft to go from left to right, rather than right-to-left which is was resulting in unituitive errors.
  • Add a name property to BinaryOp, allowing errors to include the binary operator name (rather than just "binary operator")
  • Changed the user-display for:
    • ? is now <unknown-type> (this should happen very rarely)
    • ?[] is now array
    • pair(?, ?) is now pair
  • Fixed a bug where multiple indexes would return an index error for every index, instead of just once.
    • Additionally, return the proper type found rather than ?.
- `TypeMismatch` errors will now show the expected type, and what was found ("Got") - When type-checking arrays and function params, use `foldLeft` to go from left to right, rather than right-to-left which is was resulting in unituitive errors. - Add a `name` property to `BinaryOp`, allowing errors to include the binary operator name (rather than just "binary operator") - Changed the user-display for: - `?` is now `<unknown-type>` (this should happen very rarely) - `?[]` is now `array` - `pair(?, ?)` is now `pair` - Fixed a bug where multiple indexes would return an index error for every index, instead of just once. - Additionally, return the proper type found rather than `?`.
gk1623 commented 2025-02-07 14:32:27 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

added 1 commit

  • ba1b7d67 - fix: return proper type in non-array index error (instead of `?`)

Compare with previous version

added 1 commit <ul><li>ba1b7d67 - fix: return proper type in non-array index error (instead of `?`)</li></ul> [Compare with previous version](/lab2425_spring/WACC_37/-/merge_requests/15/diffs?diff_id=148794&start_sha=88ddca2b987ffdf395f3cf834baa66751dd2352f)
gk1623 commented 2025-02-07 14:36:53 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

changed the description

changed the description
gc1523 commented 2025-02-07 14:52:21 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

approved this merge request

approved this merge request
gk1623 commented 2025-02-07 15:07:36 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

mentioned in commit ba5445a4c5

mentioned in commit ba5445a4c56bc5ebd6fecf24025d305be727a006
gk1623 (Migrated from gitlab.doc.ic.ac.uk) merged commit ba5445a4c5 into master 2025-02-07 15:07:36 +00:00
gc1523 (Migrated from gitlab.doc.ic.ac.uk) approved these changes 2025-10-16 16:43:50 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Imperial-MEng/WACC_37#15
No description provided.