@@ -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,41 @@ 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 `B == 2`, then should that apply to an independent goal or not?
2020
+ testIndepGoals7 :: String -> SolverTest
2021
+ testIndepGoals7 name =
2022
+ constraints [ExVersionConstraint (scopeToplevel " B" ) (V. thisVersion (V. mkVersion [2 , 0 , 0 ]))] $
2023
+ independentGoals $
2024
+ mkTest db name [" A" ] $
2025
+ -- TODO: Place correct string here when it fails
2026
+ solverFailure (const False )
2027
+ where
2028
+ db :: ExampleDb
2029
+ db =
2030
+ [ Right $ exAv " A" 1 [ExAny " B" ]
2031
+ , Right $ exAv " B" 1 [ExAny " does-not-exist" ]
2032
+ , Right $ exAv " B" 2 []
2033
+ , Right $ exAv " B" 3 [ExAny " does-not-exist" ]
2034
+ ]
2035
+
2036
+ -- This test checks how the scope of a constraint interacts with qualified goals.
2037
+ -- If you specify `any.B == 2`, then that should apply inside an independent goal.
2038
+ testIndepGoals8 :: String -> SolverTest
2039
+ testIndepGoals8 name =
2040
+ constraints [ExVersionConstraint (ScopeAnyQualifier " B" ) (V. thisVersion (V. mkVersion [2 , 0 , 0 ]))] $
2041
+ independentGoals $
2042
+ mkTest db name [" A" ] $
2043
+ solverSuccess [(" A" , 1 ), (" B" , 2 )]
2044
+ where
2045
+ db :: ExampleDb
2046
+ db =
2047
+ [ Right $ exAv " A" 1 [ExAny " B" ]
2048
+ , Right $ exAv " B" 1 []
2049
+ , Right $ exAv " B" 2 []
2050
+ , Right $ exAv " B" 3 []
2051
+ ]
2052
+
2016
2053
-- | cabal must set enable-exe to false in order to avoid the unavailable
2017
2054
-- dependency. Flags are true by default. The flag choice causes "pkg" to
2018
2055
-- depend on "false-dep".
0 commit comments