Skip to content

[SwiftSyntax] Adjustments because VariableDeclSyntax etc. are no longer expressible by string literals #63251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions test/Macros/Inputs/syntax_macro_definitions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,13 @@ extension TypeWrapperMacro: MemberDeclarationMacro {
attachedTo decl: DeclSyntax,
in context: inout MacroExpansionContext
) throws -> [DeclSyntax] {
let storageVariable: VariableDeclSyntax =
let storageVariable: DeclSyntax =
"""
private var _storage = _Storage()
"""

return [
DeclSyntax(storageVariable),
storageVariable,
]
}
}
Expand Down Expand Up @@ -355,17 +355,17 @@ public struct AddMembers: MemberDeclarationMacro {
attachedTo decl: DeclSyntax,
in context: inout MacroExpansionContext
) throws -> [DeclSyntax] {
let storageStruct: StructDeclSyntax =
let storageStruct: DeclSyntax =
"""
struct Storage {}
"""

let storageVariable: VariableDeclSyntax =
let storageVariable: DeclSyntax =
"""
private var storage = Storage()
"""

let instanceMethod: FunctionDeclSyntax =
let instanceMethod: DeclSyntax =
"""
func getStorage() -> Storage {
print("synthesized method")
Expand All @@ -374,9 +374,9 @@ public struct AddMembers: MemberDeclarationMacro {
"""

return [
DeclSyntax(storageStruct),
DeclSyntax(storageVariable),
DeclSyntax(instanceMethod),
storageStruct,
storageVariable,
instanceMethod,
]
}
}