Open DanTup opened 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:
thisType
works for augmentations (see https://github.com/dart-lang/sdk/issues/55312#issuecomment-2049987641) so that the Flutter.isDiagnosticable
check can workaugmented()
works to calling augmented methods (this wasn't implemented last time I checked, but I think was being worked on)Some cases that should be tested:
debugFillProperties
(we need to produce a new debugFillProperties
that is not an augmentation)debugFillProperties
(we need to produce a debugFillProperties
that is an augmentation)debugFillProperties
(ensures we look up the chain to see if we need to produce an augmentation)debugFillProperties
(ensure we look at intermediate augmentations and not only the original class definition)debugFillProperties
(ensure we can add to an existing debugFillProperties
)debugFillProperties
(ensure we add to the augmented debugFillProperties
and not the original class definition)
The
AddDiagnosticPropertyReference
fix should handle augmented fields by augmenting thedebugFillProperties
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 augmenteddebugFillProperties
.