Your macro implementations looks good, thank you for working on it! I (very recently) fixed a compiler bug that caused the incorrect error messages, and with my locally-built compiler (and adding a bunch of @expression
utterances), your result-builder macro works. My fix hasn't made it into a snapshot yet, but here's a one-off toolchain that contains it.
Yes, they do! I updated your example macro to this:
let stringClosure = #apply(resultBuilder: StringAppender.self) {
"This"
"is"
"a"
"sentence."
}
and taught the macro implementation to look for a trailing closure as well:
guard
let resultBuilderSelfExpr = node.argumentList.first?.expression.as(MemberAccessExprSyntax.self),
let resultBuilderName = resultBuilderSelfExpr.base?.withoutTrivia().description,
let originalClosure = node.argumentList.dropFirst().first?.expression.as(ClosureExprSyntax.self) ??
node.trailingClosure
else {
throw SomeError()
}
and it works fine.
Doug