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
import Testing
struct `My example tests` {@Testfunc `one little test`() {}@Testfunc `and/another/one`(){}}
The test functions are correctly treated as having display names, but the suite is not. Because it doesn't have @Suite, its name is inferred at runtime instead of at compile time. Adding @Suite correctly infers the name.
This should be a mostly trivial fix: if the name of the type is a raw identifier and the suite is synthesized, treat the type name as the suite's display name.
There's an edge case here where backticks are used for names that are not raw (e.g. struct `notraw`), but we would need to pull in swift-syntax at runtime to detect those. We can change the rules here and simply infer that any use of backticks around a type or function name produces a display name (but won't produce the diagnostic we get when you also specify a display name with a string literal, because it might be necessary in that case I guess.) No there isn't, because such names won't have backticks when demangled. So we're fine.
The text was updated successfully, but these errors were encountered:
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.
Uh oh!
There was an error while loading. Please reload this page.
Run the following code:
The test functions are correctly treated as having display names, but the suite is not. Because it doesn't have
@Suite
, its name is inferred at runtime instead of at compile time. Adding@Suite
correctly infers the name.This should be a mostly trivial fix: if the name of the type is a raw identifier and the suite is synthesized, treat the type name as the suite's display name.
There's an edge case here where backticks are used for names that are not raw (e.g. struct `notraw`), but we would need to pull in swift-syntax at runtime to detect those. We can change the rules here and simply infer that any use of backticks around a type or function name produces a display name (but won't produce the diagnostic we get when you also specify a display name with a string literal, because it might be necessary in that case I guess.)No there isn't, because such names won't have backticks when demangled. So we're fine.The text was updated successfully, but these errors were encountered: