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

Add support for enums on the match expression #841

Merged
merged 1 commit into from
Dec 18, 2021
Merged

Conversation

philberty
Copy link
Member

@philberty philberty commented Dec 16, 2021

This adds in the initial support MatchExpression which allows us to start testing much
more complex rust code. Ideally we can now start targeing the #682 to find nasty bugs
early as possible.

This takes the MatchExpr and generates a SWITCH_EXPR with associated
CASE_LABEL_EXPR's for the variants that the qualifier contains.

To improve this support in order to take advantage of SWITCH_ALL_CASES_P
to add error checking for all cases being covered. This will require changes
to the enum data structure to use ENUMERAL_TYPES instead of the flat i64
so the enumerable type contains the list of all possible permutations.

This patch is the first pass at the MatchExpr as the patch is already pretty
large and serves as a base to move forward.

Fixes #190

@philberty philberty added the WIP label Dec 16, 2021
@philberty philberty self-assigned this Dec 16, 2021
@philberty philberty changed the title Add support for enums on the match expression - wip Add support for enums on the match expression Dec 17, 2021
@philberty philberty removed the WIP label Dec 17, 2021
@philberty philberty added this to the Control Flow 2 milestone Dec 17, 2021
@philberty philberty force-pushed the phil/match-expr branch 3 times, most recently from ce700c4 to d1c3c0f Compare December 17, 2021 16:38
This is our initial first pass of adding support for the MatchExpr though
two things stand out here. We need to switch over to using a GCC enumeral
type for the union qualifier so we get advantage of the GCC code to ensure
all variants are being addressed. We also need to fix out enum type to
get better gdb support which might be simply chaning over to the
qual_union_type.

Fixes #190
@philberty
Copy link
Member Author

bors r+

@bors
Copy link
Contributor

bors bot commented Dec 18, 2021

Build succeeded:

@bors bors bot merged commit b06de30 into master Dec 18, 2021
@philberty philberty deleted the phil/match-expr branch December 29, 2021 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support match expression
1 participant