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

Allow the type checker to accept empty values #1393

Merged
merged 72 commits into from
Jun 11, 2024

Conversation

gzanitti
Copy link
Collaborator

@gzanitti gzanitti commented May 21, 2024

No description provided.

@chriseth
Copy link
Member

Oh I wouldn't introduce a new type, this should just be the empty tuple.

@chriseth
Copy link
Member

I think we need to change the interaction between the type inference and the side effect checker a little.

Because now, statements without assignment are valid everywhere, so we cannot really make this an error in the side effect checker in non-constr functions any more (so the "Tried to add a constraint in a {} context: {expr}",-error needs to go without direct replacement).

Then I think we need to change statement_type to something like constr_function_statement_type (and keep it at the type passed in from outside).

Now whenever we enter the body of a LambdaExpression in type inference, we need to set a flag depending on its kind: When it is constr, we allow both the empty tuple and constr_function_statement_type. When it is anything else, we only allow the empty tuple. At the very outside of type inference, we start out as if it was a constr function.

std/check.asm Outdated Show resolved Hide resolved
std/utils.asm Outdated Show resolved Hide resolved
gzanitti and others added 3 commits June 6, 2024 09:44
Co-authored-by: chriseth <chris@ethereum.org>
Co-authored-by: chriseth <chris@ethereum.org>
Co-authored-by: chriseth <chris@ethereum.org>
@gzanitti gzanitti requested a review from chriseth June 10, 2024 14:26
@chriseth chriseth added this pull request to the merge queue Jun 11, 2024
Merged via the queue into powdr-labs:main with commit ed64f5c Jun 11, 2024
6 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Jul 1, 2024
This PR builds on top of #1393.
It mainly modifies the grammar by changing the way SelectedExpressions
are declared, to allow blocks to be empty.

---------

Co-authored-by: chriseth <chris@ethereum.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants