Simplify the thunk names we generate for test functions. #750
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.
Parameterized test functions with the same name but different argument types currently get the same generated names from swift-syntax, so we do some additional decorating to ensure uniqueness. This results in very long symbol names that
swift-demangle
has trouble with.This PR changes the decorating formula. Previously, we would include a copy of the test function's signature (stripped of whitespace, Unicode, and non-identifier-friendly ASCII) and, if the identifier contained non-ASCII characters, the CRC32 of the identifier for further uniqueness. This change drops the copy of the identifier name and always includes the CRC32. Collisions are only possible for fully-qualified test function names that are identical, and I naïvely judge the risk of those collisions to be sufficiently low that we can make this change.
For
ZipTests.allElementsEqual😀(i:j:)
we currently generate a thunk named:This change would change it to:
Which demangles to:
The benefit of the change is that the generated names are shorter and easier to read when expanding a macro, and play better with the demangler. There may also be some benefit on Windows where the linker has a 65KB symbol name cap, although we're not exporting these symbols so probably not.
Checklist: