Signature fields named nil, true or false keep their names - #248
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The property test "signature dump/load round-trips the serialized contract" failed on #247's CI with the generated spec
"nil: string -> a: string": the loaded signature's input was:""where it wasnil. This happens on main and on v0.5.0 as well. The property hit it by chance.The cause: a field name written as text becomes its existing atom, and
"nil"became the atomnil.Field.dump/1then wroteto_string(nil), which is"".A name written as
nil,trueorfalsenow keeps its text, so the field is named"nil"and saves and loads as"nil". A field given the atomnil,trueorfalseas its name is refused withArgumentError, since those atoms are values, not names.Two tests in
test/property_invariants_test.exs:Field.new(nil, :input)raises.With main's
field.ex, both fail (5 properties, 2 tests, 2 failures). With this change:5 properties, 35 tests, 0 failuresacross the property, repeated-names, signature-optimizer and doc-contract tests.mix compile --warnings-as-errorsis clean.