Skip to content

Support defining Union inside a dataclass#1362

Merged
czgdp1807 merged 4 commits into
lcompilers:mainfrom
czgdp1807:tagged_union
Dec 26, 2022
Merged

Support defining Union inside a dataclass#1362
czgdp1807 merged 4 commits into
lcompilers:mainfrom
czgdp1807:tagged_union

Conversation

@czgdp1807

Copy link
Copy Markdown
Collaborator

No description provided.

@czgdp1807 czgdp1807 marked this pull request as ready for review December 15, 2022 12:00
x: i32
y: i64
b: B
c: i32

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perfect! While at this, given the new StructStaticMember, can you also please add a test for:

@dataclass
class A:
    @dataclass
    class B(Union):
        x: i32
        y: i64
    b: B
    c: i32

Essentially a "struct in struct"? We will need it too sooner or later, so now is the time to make sure it works.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done. Please let me know if there is anything else to do here.

@certik certik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is fine. I haven't checked the verify() changes in detail, hopefully they are correct.

@czgdp1807 czgdp1807 enabled auto-merge (squash) December 26, 2022 10:37
@czgdp1807 czgdp1807 merged commit e6cff59 into lcompilers:main Dec 26, 2022
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.

2 participants