dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.19k stars 1.57k forks source link

AddDiagnosticPropertyReference should handle augmentations #55326

Open DanTup opened 6 months ago

DanTup commented 6 months ago

The AddDiagnosticPropertyReference fix should handle augmented fields by augmenting the debugFillProperties method in the same class augmentation as the fields.

Currently, the assist/fix is unavailable for fields in augmentations (disabled in https://dart-review.googlesource.com/c/sdk/+/360043 due to the errors noted in https://github.com/dart-lang/sdk/issues/55312).

The debugFillProperties augmentation should call the augmented debugFillProperties.

DanTup commented 6 months ago

I had a quick look through the code for this and I think the required change is probably fairly minor:

If creating a new definition for debugFillProperties in an augmentation and there is already a debugFillProperties in a prior augmentation or the class definition, an augmentation should be emitted instead (eg. it should be marked with augment and should call augmented() instead of super.debugFillProperties)

However it does require that:

Some cases that should be tested: