Skip to content

Commit 17d3b87

Browse files
committed
Explicitly specify the type on which the accessor is declared
1 parent 2fd8f1f commit 17d3b87

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Sources/TestingMacros/Support/TestContentGeneration.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,19 @@ func makeTestContentRecordDecl(named name: TokenSyntax, in typeName: TypeSyntax?
6363
IntegerLiteralExprSyntax(context, radix: .binary)
6464
}
6565

66+
var accessorExpr: ExprSyntax = if let typeName {
67+
"\(typeName.trimmed).\(accessorName)"
68+
} else {
69+
"\(accessorName)"
70+
}
71+
accessorExpr = "{ unsafe \(accessorExpr)($0, $1, $2, $3) }"
72+
6673
var result: DeclSyntax = """
6774
@available(*, deprecated, message: "This property is an implementation detail of the testing library. Do not use it directly.")
6875
private nonisolated \(staticKeyword(for: typeName)) let \(name): Testing.__TestContentRecord = (
6976
\(kindExpr), \(kind.commentRepresentation)
7077
0,
71-
unsafe { unsafe \(accessorName)($0, $1, $2, $3) },
78+
\(accessorExpr),
7279
\(contextExpr),
7380
0
7481
)

0 commit comments

Comments
 (0)