Skip to content

Commit

Permalink
Clearer warning message when you provide an unimplemented default val…
Browse files Browse the repository at this point in the history
…ue inside an @DependencyClient. (#167)
  • Loading branch information
ZevEisenberg committed Jan 5, 2024
1 parent 38a9223 commit a22fd06
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Sources/DependenciesMacrosPlugin/Support.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ extension InitializerClauseSyntax {
node: self.value,
message: MacroExpansionWarningMessage(
"""
Do not use 'unimplemented' with '@\(attribute.attributeName)'; it is a replacement and \
implements the same runtime functionality as 'unimplemented' at compile time
Do not use 'unimplemented' with '@\(attribute.attributeName)'; the \
'@\(attribute.attributeName)' macro already includes the behavior of \
'unimplemented'.
"""
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ final class DependencyClientMacroTests: BaseTestCase {
var bar: () -> Int = unimplemented()
┬──────────────
├─ 🛑 '@DependencyClient' default must be closure literal
╰─ ⚠️ Do not use 'unimplemented' with '@DependencyClient'; it is a replacement and implements the same runtime functionality as 'unimplemented' at compile time
╰─ ⚠️ Do not use 'unimplemented' with '@DependencyClient'; the '@DependencyClient' macro already includes the behavior of 'unimplemented'.
}
"""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ final class DependencyEndpointMacroTests: BaseTestCase {
var bar: () -> Int = unimplemented()
┬──────────────
├─ 🛑 '@DependencyEndpoint' default must be closure literal
╰─ ⚠️ Do not use 'unimplemented' with '@DependencyEndpoint'; it is a replacement and implements the same runtime functionality as 'unimplemented' at compile time
╰─ ⚠️ Do not use 'unimplemented' with '@DependencyEndpoint'; the '@DependencyEndpoint' macro already includes the behavior of 'unimplemented'.
}
"""
}
Expand Down

0 comments on commit a22fd06

Please sign in to comment.