Hello all,
I noticed some unfamiliar syntax in the swift-testing codebase and was hoping someone could explain it. Specifically, in the Suite
macro definition, the first parameter displayName has a _const
modifier:
@attached(member) @attached(peer) public macro Suite(
_ displayName: _const String? = nil,
_ traits: any SuiteTrait...
) = #externalMacro(module: "TestingMacros", type: "SuiteDeclarationMacro")
I'm not familiar with the _const
parameter modifier. Could someone please explain what it does and how it affects the argument passed to this function?
I'm also interested to learn more about these underscored parameter modifiers in general. I see there's a UnderscoredAttributes.md reference in the Swift repo that covers the underscored attributes. I wonder if there is a similar documentation or note available for these kind of parameter modifiers. If anyone has pointers to documentation or examples for these modifiers, I'd appreciate it! Just trying to level up on some of the deeper Swift syntax.