Skip to content

Commit

Permalink
Run swift-format
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis authored and github-actions[bot] committed Aug 28, 2024
1 parent 3a1e653 commit 78e7d4e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Sources/MacroTesting/AssertMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ public func assertMacro(
var expandedSourceFile = origSourceFile.expand(
macros: macros,
contextGenerator: { syntax in
BasicMacroExpansionContext(sharingWith: context, lexicalContext: syntax.allMacroLexicalContexts())
BasicMacroExpansionContext(
sharingWith: context, lexicalContext: syntax.allMacroLexicalContexts())
},
indentationWidth: indentationWidth
)
Expand Down
2 changes: 1 addition & 1 deletion Tests/MacroTestingTests/EntryMacroTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ final class EntryMacroTests: BaseTestCase {
override func invokeTest() {
withMacroTesting(
macros: [
EntryMacro.self,
EntryMacro.self
]
) {
super.invokeTest()
Expand Down
8 changes: 5 additions & 3 deletions Tests/MacroTestingTests/MacroExamples/EntryMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ public struct EntryMacro: AccessorMacro {
in context: some MacroExpansionContext
) throws -> [AccessorDeclSyntax] {
let isInEnvironmentValues = context.lexicalContext.contains { lexicalContext in
lexicalContext.as(ExtensionDeclSyntax.self)?.extendedType.trimmedDescription == "EnvironmentValues"
lexicalContext.as(ExtensionDeclSyntax.self)?.extendedType.trimmedDescription
== "EnvironmentValues"
}

guard isInEnvironmentValues else {
throw MacroExpansionErrorMessage("'@Entry' macro can only attach to var declarations inside extensions of EnvironmentValues")
throw MacroExpansionErrorMessage(
"'@Entry' macro can only attach to var declarations inside extensions of EnvironmentValues")
}

return [
AccessorDeclSyntax(accessorSpecifier: .keyword(.get)) {
"fatalError()"
},
}
]
}
}

0 comments on commit 78e7d4e

Please sign in to comment.