Skip to content

Allow UDL to define Enums with objects#2412

Merged
mhammond merged 1 commit intomozilla:mainfrom
mhammond:push-oytqxyztvyqy
Jan 21, 2025
Merged

Allow UDL to define Enums with objects#2412
mhammond merged 1 commit intomozilla:mainfrom
mhammond:push-oytqxyztvyqy

Conversation

@mhammond
Copy link
Copy Markdown
Member

proc-macros already support this, as verified by new tests.

Fixes #1372

@mhammond mhammond requested a review from a team as a code owner January 21, 2025 15:58
@mhammond mhammond requested review from gruberb and removed request for a team January 21, 2025 15:58
assert(false)
}

switch getAnimalEnum(animal: Animal.cat) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
switch getAnimalEnum(animal: Animal.cat) {
switch getAnimalEnum(animal: Animal.cat) {

let type_ = ci.resolve_type_expression(&self.type_)?;
if let Type::Object { .. } = type_ {
bail!("Objects cannot currently be used in enum variant data");
}
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 love these PRs, we just need to delete the code that's stopping users from doing the things they want.

proc-macros already support this, as verified by new tests.

Fixes mozilla#1372
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.

Support interface types as enum variant fields

3 participants