-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[breaking change] Change the superinterface of IntX
#59776
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
Comments
FYI @lrhn, @itsjustkevin. |
SGTM! |
Have to decide whether it's a major version increment (in which var is allowed to be breaking, but might be harder to push to every user) or a breaking minor version increment (in what case we do want the breaking change process to ensure that we don't actually break anything on a minor version). I'm fine with a minor version increment if stakeholders accept it. It might be breaking, but it takes real effort to write code that'd break. Can't be just a patch version increment. it actually changes something that people might want to opt in to, so it should have a real release version. |
Sounds good, this is also what https://dart-review.googlesource.com/c/core/+/401680 does. |
@itsjustkevin, are there any further steps to take before this can be approved? |
2 similar comments
@itsjustkevin, are there any further steps to take before this can be approved? |
@itsjustkevin, are there any further steps to take before this can be approved? |
@leonsenft @johnmccutchan @mraleph please take a look at this breaking change request. |
LGTM |
2 similar comments
LGTM |
LGTM |
This breaking change is officially approved! |
Done. The change is currently -wip. It will be released as a regular version when it has been vetted for breakage. |
Change Intent
IntX
implementsComparable<IntX>
rather thanComparable<Object>
.Justification
Currently,
Int64
andInt32
have no supertypeK
such thatK extends Comparable<K>
. This causes all invocations of methods likesortedBy
to fail. Inference fails, and it is also impossible to specify the actual type argument explicitly because there is no solution to the given constraintK extends Comparable<K>
.The change proposed here makes
IntX
a solution to the constraint, which means that it can be specified manually. Moreover, it can be inferred automatically starting with Dart 3.7.0 (because it has the new feature proposed in dart-lang/language#3009).Impact
No impact is expected.
Of course, it is always possible to find an expression that breaks (
assert(Int64(1) is! Comparable<IntX>)
), but the change did not give rise to any failures in a TAP Presubmit in internal code, and there are no known examples of breakage with any practical relevance.Mitigation
No mitigation needed. Developers may wish to use
sortedBy
and similar methods in situations where it was previously not possible, but this is an option, not a necessity.Change Timeline
ASAP.
Associated CLs
dart-lang/core#866
The text was updated successfully, but these errors were encountered: