Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis committed Jul 19, 2024
1 parent 2e05064 commit d433fc9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Sources/Dependencies/DependencyKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ extension DependencyKey {
let (argument, override) =
DependencyValues.currentDependency.name
.map {
"\($0)" == "subscript(_:)"
"\($0)" == "subscript(key:)"
? ("@Dependency(\(typeName(Self.self)).self)", "'\(typeName(Self.self)).self'")
: ("@Dependency(\\.\($0))", "'\($0)'")
}
Expand Down
12 changes: 7 additions & 5 deletions Sources/Dependencies/DependencyValues.swift
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ package final class CachedValues: Sendable {
)

var argument: String {
"\(function)" == "subscript(_:)" ? "\(typeName(Key.self)).self" : "\\.\(function)"
"\(function)" == "subscript(key:)"
? "\(typeName(Key.self)).self"
: "\\.\(function)"
}

reportIssue(
Expand All @@ -419,13 +421,13 @@ package final class CachedValues: Sendable {
To fix you can do one of two things:
* Conform '\(typeName(Key.self))' to the 'DependencyKey' protocol by providing \
Conform '\(typeName(Key.self))' to the 'DependencyKey' protocol by providing \
a live implementation of your dependency, and make sure that the conformance is \
linked with this current application.
* Override the implementation of '\(typeName(Key.self))' using 'withDependencies'. \
This is typically done at the entry point of your application, but can be done \
later too.
Override the implementation of '\(typeName(Key.self))' using \
'withDependencies'. This is typically done at the entry point of your \
application, but can be done later too.
""",
fileID: DependencyValues.currentDependency.fileID ?? fileID,
filePath: DependencyValues.currentDependency.filePath ?? filePath,
Expand Down

0 comments on commit d433fc9

Please sign in to comment.