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

Require rules to be over T when sorting #11

Closed
wants to merge 1 commit into from
Closed

Require rules to be over T when sorting #11

wants to merge 1 commit into from

Conversation

shilangyu
Copy link
Contributor

When sorting a list the rules should be applicable to the list elements (T). Before the sorted extension would allow for arbitrary rules, which would crash at runtime if the types do not match.

SortedRule should be contravariant over T rather than covariant. With a bit of hacking this should be possible to enforce, but might make the API uglier.

@shilangyu
Copy link
Contributor Author

Closing. Without correct variance in Dart typing SortedRule with T is less correct than with dynamic. Proposal for variance hasn't budged since 2019 dart-lang/language#557

@shilangyu shilangyu closed this Aug 2, 2023
@shilangyu shilangyu deleted the feat/stricter-types branch August 2, 2023 06:02
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.

1 participant