Fix double props when inherited from parameterized class [#1228] #1303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sometimes, when a subclass inherits a property from a parameterized
class, the property appears twice in the docs.
That happens, because (by some reason, I'm not sure why) the field
objects for those getters and setters have different references
(though they are the same - their names are the same, returning types
are the same, etc). Since
FieldElementImpl
doesn't override defaultequality, after we added the field for getter into
_inheritedProperties
, when handling setter, we compare fields ofgetter and setter by reference there:
dartdoc/lib/src/model.dart
Line 479 in 38a7863
And usually these are the same object, so we won't see 2 properties in
the generated docs. But in that case by some reason they are 2 different
objects, so we add the field of the setter as well, and then we have 2
same props in the generated docs as a result.
It seems like we can safely compare their names (since there couldn't be
2 properties with the same name in a class anyway). That would fix the
problem.
I've added that in this commit, and also a unit test covering that case.
Fixes #1228