File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -929,7 +929,9 @@ toCgStatement stmt = case stmt of
929929 lhs' <- fixVars IsPat lhs
930930 return [CgStatement lhs' gen']
931931 FlatAllStatement v e g -> do
932- cg <- withScopeFor (scopeVars g <> vars e) $ do
932+ -- withinNegation enforces that bindings within the all are local
933+ -- to this scope and not visible outside.
934+ cg <- withinNegation $ withScopeFor (scopeVars g <> vars e) $ do
933935 stmts <- reorderGroup g
934936 e' <- fixVars IsExpr e
935937 return [CgAllStatement v e' stmts]
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ import Glean.Typed.Binary
3636import Glean.Types
3737
3838import qualified Data.HashMap.Strict as HashMap
39- import Data.Set
39+ import Data.Set as Set
4040
4141import Test.HUnit
4242import TestRunner
@@ -161,6 +161,11 @@ setSemanticsTest dbTestCase = TestList
161161 r <- runQuery_ env repo $ angleData @ Nat
162162 [s | X where _ = all (X = 1); X = 0 |]
163163 assertEqual " unused all" r [Nat 0 ]
164+ , TestLabel " local constraint" $ dbTestCase $ \ env repo -> do
165+ r <- runQuery_ env repo $ angleData @ (Set Nat )
166+ [s | all (X where X = 1) where X = 1|2 |]
167+ assertEqual " local constraint"
168+ (sort r) [Set. empty, Set. fromList [Nat 1 ]]
164169 ]
165170
166171setLimitTest :: Test
You can’t perform that action at this time.
0 commit comments