10000 Hide Hash::Elem in detailed type errors by jez · Pull Request #8038 · sorbet/sorbet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Hide Hash::Elem in detailed type errors #8038

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
Jul 19, 2024
Merged

Hide Hash::Elem in detailed type errors #8038

merged 2 commits into from
Jul 19, 2024

Conversation

jez
Copy link
Collaborator
@jez jez commented Jul 17, 2024

Motivation

Two types disagreeing for the type of Hash::Elem is always noise, because
Sorbet creates this type implicitly when constructing a hash. It behaves as if
it has the type [Hash::K, Hash::V] (2-tuple) for all hashes.

Test plan

See included automated tests.

@jez jez requested a review from a team as a code owner July 17, 2024 22:11
@jez jez requested review from ilyailya and removed request for a team July 17, 2024 22:11
@jez jez enabled auto-merge (squash) July 17, 2024 22:25
@jez jez requested review from neilparikh and froydnj and removed request for ilyailya July 19, 2024 01:36
Copy link
Collaborator
@neilparikh neilparikh left a comment

Choose a reason for hiding this comment

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

one optional nit, LGTM otherwise

joiningText = "a supertype of";
break;
if (!(a2->klass == Symbols::Hash() &&
idxTypeMember.data(gs)->name == core::Names::Constants::Elem())) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can flip the condition and then do a early break here, to avoid the additional nesting.

@jez jez merged commit e44b102 into master Jul 19, 2024
16 checks passed
@jez jez deleted the jez-hash-detailed branch July 19, 2024 18:31
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.

2 participants
0