You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Synthesize display names for de facto suites with raw identifiers. (#1105)
This PR ensures that suite types that don't have the `@Suite` attribute
but which _do_ have raw identifiers for names are correctly given
display names the same way those with `@Suite` would be. This PR also
ensures that we transform spaces in raw identifiers after they are
demangled by the runtime--namely, the runtime replaces ASCII spaces (as
typed by the user) with Unicode non-breaking spaces (which aren't
otherwise valid in raw identifers) in order to avoid issues with
existing uses of spaces in demangled names. We want to make sure that
identifiers as presented to the user match what the user has typed, so
we need to transform these spaces back. No changes in this area are
needed for display names derived during macro expansion because we do
the relevant work based on the source text which still has the original
ASCII spaces.
This PR also deletes the "`raw$`" hack that I put in place when
originally implementing raw identifier support as the entire toolchain
supports them now.
Resolves#1104.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
/// Replace any non-breaking spaces in the given string with normal spaces.
146
+
///
147
+
/// - Parameters:
148
+
/// - rawIdentifier: The string to rewrite.
149
+
///
150
+
/// - Returns: A copy of `rawIdentifier` with non-breaking spaces (`U+00A0`)
151
+
/// replaced with normal spaces (`U+0020`).
152
+
///
153
+
/// When the Swift runtime demangles a raw identifier, it [replaces](https://github.com/swiftlang/swift/blob/d033eec1aa427f40dcc38679d43b83d9dbc06ae7/lib/Basic/Mangler.cpp#L250)
154
+
/// normal ASCII spaces with non-breaking spaces to maintain compatibility
155
+
/// with historical usages of spaces in mangled name forms. Non-breaking
156
+
/// spaces are not otherwise valid in raw identifiers, so this transformation
0 commit comments