You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add fix-it when there's a package target with similar name as the one provided in the dependency (#6897)
Update error message when there's a package target with a similar name as the one provided in the dependency.
### Motivation:
Partially addresses #4803.
It adds a suggestion for an alternative dependency name when there's a dependency target with similar name as the one provided in the `Package.swift`.
### Modifications:
Use the existing `bestMatch(for, from)` from TSCBasic to compare the `productRef.name` and `allTargetNames`.
However, I'm not sure how and if I can include target from system packages.
### Result:
Error messages for package target not found may also suggest an alternative name like:
`product 'Barx' required by package 'foo' target 'FooTarget' not found. Did you mean 'Bar'?`
return"product '\(dependencyProductName)' is declared in the same package '\(package)' and can't be used as a dependency for target '\(targetName)'."
225
225
}else{
226
-
return"product '\(dependencyProductName)' required by package '\(package)' target '\(targetName)' \(dependencyPackageName.map{"not found in package '\($0)'"}??"not found")."
226
+
vardescription="product '\(dependencyProductName)' required by package '\(package)' target '\(targetName)' \(dependencyPackageName.map{"not found in package '\($0)'"}??"not found")."
227
+
iflet similarProductName {
228
+
description +=" Did you mean '\(similarProductName)'?"
0 commit comments