-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Large-scale dart fix for hashValues
and hashList
#48204
Comments
Should this be a hint? |
Sorry I didn't notice this earlier.
Could you elaborate a bit on what makes them difficult and lengthy to write?
I'm not sure what you're suggesting here.
These functions are marked as deprecated, so users should already be getting a diagnostic pointing them to the replacement. I don't think a second hint would help. |
I think this sounds similar to #46464, maybe? The migration @werainkhatri did in flutter/flutter#96109 migrated over a hundred classes, which would mean over a hundred dart fixes would need to be written, one for every class. I think @werainkhatri was looking to see if there is a way to consolidate and simplify that. |
If I may say something for the discussion, one of the reasons to have a fix, is that it would be used for many use cases, preferably by a wide user base, otherwise, we would need a fix for each deprecated method, which would frequently happen on the long run. On the other hand, I wonder if there is some specific API to be exposed to a potential project team to handle specific project code modifications. |
I must be really confused. Perhaps a VC is in order. Because when I look at the PR it appears to be the case that two top-level functions were replaced by two static methods. The invocation sites might have been in a hundred classes, but you would only need two transforms to make all those changes. So I'm not sure how we'd consolidate that.
Of course. Your input is always welcome.
Absolutely.
That's actually what we're discussing here. We have something called data-driven fixes that allows the Flutter team to describe the fixes appropriate for API changes. We are exploring whether to make this more widely available to other package authors. |
so IIUTC, the below transform should be the only fix required (for - title: 'Replace `hashValues` with `Object.hash`'
date: 2020-11-20
element:
uris: [ 'material.dart' ]
function: 'hashValues'
changes:
- kind: 'replacedBy'
newElement:
uris: [ 'material.dart' ]
method: 'hash' # EDIT: was field, my bad
inClass: 'Object' but it gives an analysis error.
|
Yes, modulo the fact that So I believe that there are two enhancements needed here:
Both of those are being requested for other reasons, but the work hasn't been scheduled yet. |
sdk/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart Lines 85 to 89 in 5ca6eec
|
…another one Bug: #48204 Change-Id: Id13f038e39e9e150e1d6b21bcdde25bb815b15a6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241004 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
any update on this? i see cross-package replacedBy is allowed now, but
is yet to be supported. |
@werainkhatri, are you still looking to write a fix for this type of migrations? |
yes! |
hashValues
andhashList
being top-level functions are difficult and lengthy to write data-driven fixes for. It would be nice if there was a global dart fix for these functions instead, which can be applied to them regardless of the class/import.PR that migrates these functions: flutter/flutter#96109
PR that deprecates these functions: flutter/engine#30674
Original issue: #25217
cc @Piinks @bwilkerson
The text was updated successfully, but these errors were encountered: