@@ -361,6 +361,8 @@ tests =
361
361
, runTest $ testIndepGoals5 " indepGoals5 - default goal order" DefaultGoalOrder
362
362
, runTest $ testIndepGoals6 " indepGoals6 - fixed goal order" FixedGoalOrder
363
363
, runTest $ testIndepGoals6 " indepGoals6 - default goal order" DefaultGoalOrder
364
+ , expectFailBecause " #9466" $ runTest $ testIndepGoals7 " indepGoals7"
365
+ , runTest $ testIndepGoals8 " indepGoals8"
364
366
]
365
367
, -- Tests designed for the backjumping blog post
366
368
testGroup
@@ -2013,6 +2015,33 @@ dbLangs1 =
2013
2015
, Right $ exAv " C" 1 [ExLang (UnknownLanguage " Haskell3000" ), ExAny " B" ]
2014
2016
]
2015
2017
2018
+ -- This test checks how the scope of a constraint interacts with qualified goals.
2019
+ -- If you specify `A == 2`, that top-level should /not/ apply to an independent goal!
2020
+ testIndepGoals7 :: String -> SolverTest
2021
+ testIndepGoals7 name =
2022
+ constraints [ExVersionConstraint (scopeToplevel " A" ) (V. thisVersion (V. mkVersion [2 , 0 , 0 ]))] $
2023
+ independentGoals $
2024
+ mkTest dbIndepGoals78 name [" A" ] $
2025
+ -- The more recent version should be picked by the solver. As said
2026
+ -- above, the top-level A==2 should not apply to an independent goal.
2027
+ solverSuccess [(" A" , 3 )]
2028
+
2029
+ dbIndepGoals78 :: ExampleDb
2030
+ dbIndepGoals78 =
2031
+ [ Right $ exAv " A" 1 []
2032
+ , Right $ exAv " A" 2 []
2033
+ , Right $ exAv " A" 3 []
2034
+ ]
2035
+
2036
+ -- This test checks how the scope of a constraint interacts with qualified goals.
2037
+ -- If you specify `any.A == 2`, then that should apply inside an independent goal.
2038
+ testIndepGoals8 :: String -> SolverTest
2039
+ testIndepGoals8 name =
2040
+ constraints [ExVersionConstraint (ScopeAnyQualifier " A" ) (V. thisVersion (V. mkVersion [2 , 0 , 0 ]))] $
2041
+ independentGoals $
2042
+ mkTest dbIndepGoals78 name [" A" ] $
2043
+ solverSuccess [(" A" , 2 )]
2044
+
2016
2045
-- | cabal must set enable-exe to false in order to avoid the unavailable
2017
2046
-- dependency. Flags are true by default. The flag choice causes "pkg" to
2018
2047
-- depend on "false-dep".
0 commit comments