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

LEM match values #1190

Merged
merged 3 commits into from
Mar 5, 2024
Merged

Conversation

gabriel-barrett
Copy link
Contributor

This PR introduces the more general match of values, instead of only symbols

@gabriel-barrett gabriel-barrett marked this pull request as ready for review March 3, 2024 20:10
@gabriel-barrett gabriel-barrett requested review from a team as code owners March 3, 2024 20:10
Copy link
Contributor

@arthurpaulino arthurpaulino left a comment

Choose a reason for hiding this comment

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

The code looks good! I just left one comment about a change that needs to be done

let ptr = bindings.get_ptr(match_var)?;
if ptr.tag() != &Tag::Expr(Sym) {
if ptr.tag() != &tag {
bail!("{match_var} is not a symbol");
Copy link
Contributor

Choose a reason for hiding this comment

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

This error message needs to be updated

@arthurpaulino
Copy link
Contributor

arthurpaulino commented Mar 3, 2024

Here's an idea that can be done later:

  • check should error when one of the cases doesn't match the LitType
  • The macro can panic if some case has a different LitType than the rest

The rule of thumb is that we should do our best to avoid having inconsistent MatchValues. And by "inconsistent" I mean cases whose lit types don't match the one defined on the MatchValue itself.

Copy link
Contributor

@arthurpaulino arthurpaulino left a comment

Choose a reason for hiding this comment

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

Thanks!

@gabriel-barrett gabriel-barrett added this pull request to the merge queue Mar 5, 2024
Merged via the queue into lurk-lab:main with commit 9e37e66 Mar 5, 2024
11 checks passed
@gabriel-barrett gabriel-barrett deleted the lem-match-values branch March 5, 2024 17:39
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.

3 participants