From 9dc9e07c44551247ed74d5002ef2bbdb7a6ef8f2 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Tue, 3 Oct 2023 11:24:59 -0400 Subject: [PATCH] Use `CodeBlockItemListSyntax` instead of `ExprSyntax` when constructing a test function thunk. This PR corrects a technical defect in `TestDeclarationMacro`. There should be no developer- or user-facing impact. --- Sources/TestingMacros/TestDeclarationMacro.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Sources/TestingMacros/TestDeclarationMacro.swift b/Sources/TestingMacros/TestDeclarationMacro.swift index 4ae7a112a..8e5b45d9b 100644 --- a/Sources/TestingMacros/TestDeclarationMacro.swift +++ b/Sources/TestingMacros/TestDeclarationMacro.swift @@ -308,11 +308,7 @@ public struct TestDeclarationMacro: PeerMacro, Sendable { } // Generate a thunk function that invokes the actual function. - // NOTE: `thunkBody` is not actually an expression. It's better-represented - // as an instance of CodeBlockItemListSyntax, but due to its size it is - // easier to express using string interpolation than by directly creating an - // instance of CodeBlockItemListSyntax. - var thunkBody: ExprSyntax + var thunkBody: CodeBlockItemListSyntax if functionDecl.availability(when: .unavailable).first != nil { thunkBody = "" } else if let typeName {