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

Handle coercion of default values #99

Merged
merged 3 commits into from
Oct 25, 2017
Merged

Conversation

jlouis
Copy link
Owner

@jlouis jlouis commented Oct 23, 2017

Change the dungeon such that every enumeration is an atom internally.
Observe that parameter-passed values do not enjoy being fed through
the enumeration module resolver. This is obviously a problem which
needs some addressing. In this patch, we currently detect the problem,
but we don't provide a fix yet.

Change the dungeon such that every enumeration is an atom internally.
Observe that parameter-passed values do not enjoy being fed through
the enumeration module resolver. This is obviously a problem which
needs some addressing. In this patch, we currently detect the problem,
but we don't provide a fix yet.
@jlouis
Copy link
Owner Author

jlouis commented Oct 23, 2017

I now understand the bug:

In this case, we have a default mood, and it is represented as {enum, <<"DODGY">>}. If we create a HobGoblin in the populate code, then this value is just copied in verbatim. It never undergoes non_polar_input_coercion as it should. This then creates the bug. The obvious handling is that default values should undergo parameter coercion and checks just like everything else rather than just replace.

@jlouis jlouis changed the title WIP: start understanding why enumerations are not resolved Handle coercion of default values Oct 23, 2017
@jlouis jlouis mentioned this pull request Oct 24, 2017
This plugs a hole in the coercion code with enumerated types. If an
enum is supplied as a default it was never coerced, but because the
default value was {enum, X} and the default coercer returned {enum, X}
nobody ever saw this.

Default values are now param-checked like everything else. If they
fail, the output error is different and we drop an error in the error
logger because this is a misconfiguration.
@jlouis jlouis merged commit 4acd121 into develop Oct 25, 2017
@jlouis jlouis deleted the jl/fix/enumeration-resolution branch October 25, 2017 15:53
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.

None yet

1 participant