Skip to content

Specific base typespecs #11449

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

Merged
merged 2 commits into from
Dec 5, 2021
Merged

Conversation

sorentwo
Copy link
Contributor

@sorentwo sorentwo commented Dec 5, 2021

Each Base function had keyword as the option type, which didn't help guard against typos or mismatched options.

This also includes a small fix to the identity spec, which passed unused options in many cases and used pad: rather than padding: where appropriate.

Each function had `keyword` as the option type, which didn't help guard
against typos or mismatched options.
@josevalim josevalim merged commit 1f0422a into elixir-lang:main Dec 5, 2021
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

josevalim pushed a commit that referenced this pull request Dec 5, 2021
* Use specific options for base option typespecs

Each function had `keyword` as the option type, which didn't help guard
against typos or mismatched options.

* Fix padding use in encode/decode identity test
@@ -397,7 +400,7 @@ defmodule Base do
{:ok, "foob"}

"""
@spec decode64(binary, keyword) :: {:ok, binary} | :error
@spec decode64(binary, ignore: :whitespace, padding: boolean) :: {:ok, binary} | :error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it valid to use such notation to cover reversed order of arguments decode("...", padding: true, ignore: :whitespace)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point. I've opened a PR to handle that situation.

@sorentwo sorentwo deleted the specific-base-typespecs branch December 6, 2021 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants