-
Notifications
You must be signed in to change notification settings - Fork 697
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
Show constraint sources in dependency solver errors #10524
base: master
Are you sure you want to change the base?
Conversation
4811a3c
to
0c8471d
Compare
We have a lot of `showType` functions that are effectively a `Pretty` instance but less composable. Let's make them proper `Pretty` instances. Split off of haskell#10524
9ebbba8
to
522bec9
Compare
cabal-testsuite/PackageTests/NewSdist/MultiTarget/all-test-sute.out
Outdated
Show resolved
Hide resolved
cabal-testsuite/PackageTests/ConstraintSource/SourceRepositoryPackage/cabal.out
Show resolved
Hide resolved
@jasagredo just a heads-up: on the last Cabal meeting @9999years asked to not comment on their PRs while a PR is in the draft mode. I remember it because I’m guilty in it more than many! |
522bec9
to
e52d016
Compare
c10bd7d
to
9854c9d
Compare
Needs a release note. |
9854c9d
to
9492b41
Compare
Before: [__0] rejecting: memory-0.18.0 (constraint from user target requires ==0.17.0) After: [__0] rejecting: memory-0.18.0 (constraint from cabal.project requires ==0.17.0)
9492b41
to
b27b413
Compare
Added a release note and tests, addressed comments. Should be ready to go! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a pity 3.14.1.0 is breathing down our necks; it would be nice to see this go in, seems like it'd be a big UX improvement.
import Text.PrettyPrint | ||
|
||
-- | A package bundled with a `ConstraintSource`. | ||
data WithConstraintSource pkg = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this type being used as WithContraintSource UserConstraint
so I think pkg
is not actually a pkg
? i.e. constraintPackage
is misnamed?
@@ -135,7 +141,7 @@ defaultBuildFlags = | |||
-- "Distribution.Client.ProjectOrchestration" | |||
buildAction :: NixStyleFlags BuildFlags -> [String] -> GlobalFlags -> IO () | |||
buildAction flags@NixStyleFlags{extraFlags = buildFlags, ..} targetStrings globalFlags = | |||
withContextAndSelectors RejectNoTargets Nothing flags targetStrings globalFlags BuildCommand $ \targetCtx ctx targetSelectors -> do | |||
withContextAndSelectors RejectNoTargets Nothing flags (map (\target -> WithConstraintSource{constraintPackage = target, constraintConstraint = ConstraintSourceCommandlineFlag}) targetStrings) globalFlags BuildCommand $ \targetCtx ctx targetSelectors -> do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a local bind might make this line shorter?
Before:
After:
First shot at #10519. Seems unavoidably large.
Builds off of #9578.
Future work: Propagate line numbers into these constraints!
Implementation strategy:
Propagate provenance (
ProjectConfigPath
/ConstraintSource
) into project config types (Distribution.Client.ProjectConfig
,D.C.ProjectConfig.Legacy
)Extract and attach that information in
D.C.ProjectConfig.findProjectPackages
Attach that information to
ProjectPackageLocation
(returned fromfindProjectPackages
). Note: Might be worth unifying that withPackageLocation
, would make the new typePackageLocationProvenance
.Use that information to write better
ConstraintSource
s into the solver; this is mostly implemented.Overall it seems like all the information exists, but it takes a lot of work to propagate it into the right parts of the system.