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

Report offending node in the type-checker immutability check #4238

Merged
merged 3 commits into from
Nov 13, 2023

Conversation

vlstill
Copy link
Contributor

@vlstill vlstill commented Nov 10, 2023

Currently, the compiler would produce only a very vague error message if type checking runs in immutable mode and the IR tree is actually modified. This is extremely annoying to debug. Therefore, I've added the check after each node is processed and the check now reports the offending node.

I've also modified the end_apply function (which still prints the generic check, although it is probably redundant):

  • calling parent end_apply
  • the nodes should be comparend for exact pointer equality, not for internal semantic equality -- it is not OK if the transform produces new tree that is equivalent in the readOnly mode. It must keep the original tree.

@vlstill vlstill added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Nov 10, 2023
@vlstill vlstill self-assigned this Nov 10, 2023
@vlstill vlstill marked this pull request as ready for review November 10, 2023 12:05
@vlstill
Copy link
Contributor Author

vlstill commented Nov 10, 2023

The failed tests look like some problems with dependencies rather than anything related to this change :-/.

@vlstill vlstill merged commit 72f3983 into p4lang:main Nov 13, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Topics concerning the core segments of the compiler (frontend, midend, parser)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants