Skip to content

Common structure for concrete and extern enum lowering #7738

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

Merged
merged 1 commit into from
May 11, 2025

Conversation

eytan-starkware
Copy link
Contributor

@eytan-starkware eytan-starkware commented May 8, 2025

This is in preparation for having a common trait for common code


Stack:

⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @TomerStarkware)


crates/cairo-lang-lowering/src/lower/lower_match.rs line 1341 at r1 (raw file):

/// A context for lowering patterns of enum variants in a match statement.
struct EnumVariantBuilderContext<'a> {

add fn new for this struct.
most construction now id duplicated as well.

Code quote:

struct EnumVariantBuilderContext<'a> {

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @eytan-starkware and @TomerStarkware)


crates/cairo-lang-lowering/src/lower/lower_match.rs line 1207 at r2 (raw file):

        get_underscore_pattern_path_and_mark_unreachable(ctx, match_arms, match_type);
    let variant_map =
        get_variant_to_arm_map(ctx, match_arms, extern_enum.concrete_enum_id, match_type)?;

move into the new fn.

Code quote:

    let otherwise_variant =
        get_underscore_pattern_path_and_mark_unreachable(ctx, match_arms, match_type);
    let variant_map =
        get_variant_to_arm_map(ctx, match_arms, extern_enum.concrete_enum_id, match_type)?;

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware)

Base automatically changed from spr/main/d459ccdd to main May 11, 2025 10:41
This is in preparation for having a common trait for common code

commit-id:f4e87162
@eytan-starkware eytan-starkware enabled auto-merge May 11, 2025 11:02
@eytan-starkware eytan-starkware disabled auto-merge May 11, 2025 11:02
@eytan-starkware eytan-starkware enabled auto-merge May 11, 2025 11:02
@eytan-starkware eytan-starkware added this pull request to the merge queue May 11, 2025
Merged via the queue into main with commit f310fb6 May 11, 2025
49 checks passed
@eytan-starkware eytan-starkware deleted the spr/main/f4e87162 branch May 11, 2025 12:10
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