Fix processing & linking of alias types #6
Merged
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.
Prior to this change, alias types would be added to the
processor.Types
map twice, in the case where an API defines both the alias type, and
another struct which uses either a pointer to, or an array / slice of,
an alias type. Depending on which element is processed first, the alias
type would be added to the map as an AliasKind, or a
SliceKind/ArrayKind/PointerKind. This means that where templates attempt
to render an underlying type of an Alias using
IsAlias
, the alias maybe registered as a non-alias type.
In addition, alias types were treated as Basic in the renderer if their
underlying types were basic. This means in the above case, links are not
generated to the alias type in the generated documentation, despite them
being a valid type as part of the API.
Here's an example API definition file that displays the problematic behaviour with the
Plugin
alias:Here is the diff in generated output:
This also fixes another issue where types will be missing their description if they are only ever included in other structs directly, rather than as elements in arrays or pointed to. Here's a repro:
Note that the descriptions of several included structs were previously missing.