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

Support optional keys in record types #1223

Merged
merged 2 commits into from
Sep 17, 2024
Merged

Support optional keys in record types #1223

merged 2 commits into from
Sep 17, 2024

Conversation

soutaro
Copy link
Owner

@soutaro soutaro commented Sep 15, 2024

The semantics of optional keys in record in Steep is the hash may not have any value associated with the optional key.

So,

  1. Assigning a hash without the optional key is allowed -- { id: 123 } #: { id: Integer, ?name: String }
  2. Having incompatible type with the optional key is prohibited (but, it causes unsoundness...)
  3. The #[] operator of the record type returns an optional type, #fetch returns non-optional type (if the value type is not an optional)

@soutaro soutaro added this to the Steep 1.8 milestone Sep 15, 2024
@ParadoxV5
Copy link
Contributor

@soutaro soutaro merged commit d30fa01 into master Sep 17, 2024
23 checks passed
@soutaro soutaro deleted the record-optional-key branch September 17, 2024 06:33
@soutaro soutaro added the Released The PR is already included in a published release label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Released The PR is already included in a published release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants