-
-
Notifications
You must be signed in to change notification settings - Fork 8
Various fixes #86
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
base: main
Are you sure you want to change the base?
Various fixes #86
Conversation
| type = new(opts) | ||
| constraints = | ||
| case type.constraints do | ||
| {:and, constraints} -> {:and, constraints ++ infer_constraints(predicates)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the minimal changes to make this work. But it looks like {:and, constraints} gets treated the same as just constraints, so I wonder if we can just get rid of {:and, ...} everywhere.
| @doc since: "0.1.0" | ||
|
|
||
| @spec type({atom(), []}) :: type() | ||
| @spec type({atom(), list()}) :: type() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Elixir docs say that a typespec of [] means an empty list.
|
|
||
| defp constrain(%Drops.Types.Cast{input_type: input_type} = type, predicates) do | ||
| Map.merge(type, %{ | ||
| input_type: constrain(input_type, predicates) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if the constraint should be applied to the input type, the output type, or both.
Fixes errors with certain schemas. I don't remember exactly what the schemas were that caused the errors. One of them was a union where one of the types was a custom type that was a cast or a union itself.