Skip to content

Improve defstruct @enforce_keys - #15826

Open
AlexGx wants to merge 1 commit into
elixir-lang:mainfrom
AlexGx:ag-defstruct_enforce_keys-fix
Open

Improve defstruct @enforce_keys#15826
AlexGx wants to merge 1 commit into
elixir-lang:mainfrom
AlexGx:ag-defstruct_enforce_keys-fix

Conversation

@AlexGx

@AlexGx AlexGx commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Validates @enforce_keys against declared struct fields

@AlexGx AlexGx changed the title Improve defstruct @enfore_keys Sep 1, 2026
@josevalim

Copy link
Copy Markdown
Member

Thank you but I think we can simplify the message instead:

unknown or duplicate keys given to @enforce_keys, got: [....]

And we just make sure the struct key is not taken into account and is part of the same error message. That should be much simpler.

@AlexGx
AlexGx force-pushed the ag-defstruct_enforce_keys-fix branch from 6c348ae to b692382 Compare September 1, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants