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

Does not work with @enforce_keys #21

Closed
dylan-chong opened this issue Dec 27, 2017 · 0 comments · Fixed by #23
Closed

Does not work with @enforce_keys #21

dylan-chong opened this issue Dec 27, 2017 · 0 comments · Fixed by #23

Comments

@dylan-chong
Copy link
Contributor

dylan-chong commented Dec 27, 2017

  defmodule Point do
    @enforce_keys [:x, :y]
    defstruct [:x, :y, :z]

    use ExConstructor
  end

Error when defining module:

** (ArgumentError) the following keys must also be given when building struct ExConstructorValidatorTest.Point: [:x, :y]

Could be caused by this:

%__MODULE__{},

Perhaps create struct with Kernel.struct/2 which does not check @enforce_keys like %_{} and Kernel.struct!/2 do:

Kernel.struct(__MODULE__, [])
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 a pull request may close this issue.

1 participant