Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sem: proper error propagation for set construction #1283

Merged

Conversation

zerbina
Copy link
Collaborator

@zerbina zerbina commented Apr 23, 2024

Summary

Refactor/fix set construction analysis such that:

  • nkRange nodes are properly analyzed after macro expansion
  • errors within set constructions are propagated properly

Details

Only semSetConstr is modified:

  • use shallowCopy instead of creating a new node (no sequence
    resizing, keeps the persistent node flags)
  • always re-analyze nkRange nodes (they were previously never typed)
  • guard against ill-formed nkRange AST (could previously crash the
    compiler)
  • don't modify the input AST
  • replace localReport with using nkError
  • propagate nkError

zerbina added 2 commits April 22, 2024 23:39
Summary
=======

Refactor/fix set construction analysis such that:
* `nkRange` nodes are properly analyzed after macro expansion
* errors within set constructions are propagated properly

Details
=======

Only `semSetConstr` is modified:
* use `shallowCopy` instead of creating a new node (no seq resizing,
  keeps the persistent node flags)
* always re-analyze `nkRange` nodes (they were previously never typed)
* guard against ill-formed `nkRange` AST
* don't modify the input AST
* replace `localReport` with using `nkError`
* propagate `nkError`
@zerbina zerbina added bug Something isn't working refactor Implementation refactor compiler/sem Related to semantic-analysis system of the compiler labels Apr 23, 2024
Copy link
Collaborator

@saem saem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice improvement.

@saem
Copy link
Collaborator

saem commented Apr 23, 2024

/merge

Copy link

Merge requested by: @saem

Contents after the first section break of the PR description has been removed and preserved below:


Notes for Reviewers

@chore-runner chore-runner bot added this pull request to the merge queue Apr 23, 2024
Merged via the queue into nim-works:devel with commit fa85029 Apr 23, 2024
31 checks passed
@zerbina zerbina deleted the sem-refactor-set-constr-analysis branch April 27, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler/sem Related to semantic-analysis system of the compiler refactor Implementation refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants