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.
It is common during the upgrade from one version of hyde to another that the underlying clang tooling will output different symbol names for a given symbol (e.g., a namespace may get removed or added.) Although the symbol is unchanged, because its
expected
name differs from thehave
name, hyde will consider the symbols different, remove the old name and insert the new one. This wipes out any previous documentation under the old name that should have been migrated to the new name.The solution here is very specialized. For the "overloads" key only, we gather the name of each overload in both the
have
andexpected
set. We then pair them up according to how well they match to one another (using the Meyers' string diff algorithm; two strings with less "patchwork" between them are considered a better match). Ideally this results in key pairs that represent the same symbol, just with different names. Then we call theproc
withhave[old_name]
andexpected[new_name]
which will migrate any documentation from the old name to the new.This capability assumes the overload count of both
have
andexpected
are the same. If any new functions are created or removed between upgrades in the clang driver (e.g., a new compiler-generated routine is created and documented) that will have to be managed manually. Assuming the count is the same, it also assumes there is a 1:1 mapping from the set of old names to the set of new names. This implies the transcription mode should be done as a separate step from an update. In other words, a transcription assumes the documentation is actually the same between thehave
andexpected
sets, it is just the overload names that have changed, so map the old-named documentation to the new-named documentation as reasonably as possible.This PR also performs a similar technique for class folder names, especially those that may have been mangled or hashed, as changing the symbols will cause those folder names to be different. Using the same Meyers diff, the old folder name that most closely resembles the new folder being created is found and renamed. The reconciliation process then continues as normal.