@@ -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
@@ -1968,6 +1970,43 @@ dbLangs1 =
1968
1970
, Right $ exAv " C" 1 [ExLang (UnknownLanguage " Haskell3000" ), ExAny " B" ]
1969
1971
]
1970
1972
1973
+ -- This test checks how the scope of a constraint interacts with qualified goals.
1974
+ -- If you specify `B == 2`, then should that apply to an independent goal or not?
1975
+ testIndepGoals7 :: String -> SolverTest
1976
+ testIndepGoals7 name =
1977
+ constraints [ExVersionConstraint (scopeToplevel " B" ) (V. thisVersion (V. mkVersion [2 ,0 ,0 ]))] $
1978
+ independentGoals $
1979
+ mkTest db name [" A" ] $
1980
+ -- TODO: Place correct string here when it fails
1981
+ solverFailure (const False )
1982
+ where
1983
+ db :: ExampleDb
1984
+ db =
1985
+ [ Right $ exAv " A" 1 [ExAny " B" ]
1986
+ , Right $ exAv " B" 1 [ExAny " does-not-exist" ]
1987
+ , Right $ exAv " B" 2 []
1988
+ , Right $ exAv " B" 3 [ExAny " does-not-exist" ]
1989
+ ]
1990
+
1991
+ -- This test checks how the scope of a constraint interacts with qualified goals.
1992
+ -- If you specify `any.B == 2`, then that should apply inside an independent goal.
1993
+ testIndepGoals8 :: String -> SolverTest
1994
+ testIndepGoals8 name =
1995
+ constraints [ExVersionConstraint (ScopeAnyQualifier " B" ) (V. thisVersion (V. mkVersion [2 ,0 ,0 ]))] $
1996
+ independentGoals $
1997
+ mkTest db name [" A" ] $
1998
+ solverSuccess [(" A" , 1 ), (" B" , 2 )]
1999
+ where
2000
+ db :: ExampleDb
2001
+ db =
2002
+ [ Right $ exAv " A" 1 [ExAny " B" ]
2003
+ , Right $ exAv " B" 1 []
2004
+ , Right $ exAv " B" 2 []
2005
+ , Right $ exAv " B" 3 []
2006
+ ]
2007
+
2008
+
2009
+
1971
2010
-- | cabal must set enable-exe to false in order to avoid the unavailable
1972
2011
-- dependency. Flags are true by default. The flag choice causes "pkg" to
1973
2012
-- depend on "false-dep".
0 commit comments