File tree Expand file tree Collapse file tree 4 files changed +31
-9
lines changed
src/Language/Granule/Checker
tests/cases/negative/simple Expand file tree Collapse file tree 4 files changed +31
-9
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,4 @@ example =
1616 [contacts] : (List String) [{Contacts}] = getContacts
1717 in [Cons location contacts]
1818
19- non-example : (List String) [{Contacts}]
20- non-example =
21- let [location] : String [{Location}] = getLocation;
22- [contacts] : (List String) [{Contacts}] = getContacts
23- in [Cons location contacts]
19+ -- see frontend/tests/cases/negative/simple/set.gr for a failing example
Original file line number Diff line number Diff line change @@ -11,10 +11,11 @@ import Language.Granule.Checker.Constraints.SynTree
1111import Language.Granule.Syntax.Type
1212
1313import GHC.Generics (Generic )
14+ import GHC.Stack (HasCallStack )
1415import Data.SBV hiding (kindOf , name , symbolic )
1516import qualified Data.SBV.Set as S
1617
17- solverError :: String -> a
18+ solverError :: HasCallStack => String -> a
1819solverError = error
1920
2021-- Symbolic grades, for coeffects and indices
Original file line number Diff line number Diff line change @@ -317,6 +317,14 @@ synthKindWithConfiguration s config (TyApp (TyCon (internalName -> "Set")) t) =
317317 -- otherwise kind of the set depends on the kind of the elements
318318 k -> return (k, subst, TyApp (TyCon (mkId " Set" )) t')
319319
320+ synthKindWithConfiguration s config (TyApp (TyCon (internalName -> " SetOp" )) t) = do
321+ (k, subst, t') <- synthKindWithConfiguration s config t
322+ case k of
323+ -- For set over type, default to the kind being Effect
324+ Type 0 -> return (keffect, subst, TyApp (TyCon (mkId " SetOp" )) t')
325+ -- otherwise kind of the set depends on the kind of the elements
326+ k -> return (k, subst, TyApp (TyCon (mkId " SetOp" )) t')
327+
320328-- KChkS_app
321329--
322330-- t1 => k1 -> k2 t2 <= k1
@@ -1298,9 +1306,9 @@ requiresSolver s ty = do
12981306 Right _ ->
12991307 -- avoid putting sets into the solver as the solver is weak on this
13001308 -- TODO: consider something better here
1301- case isSet ty of
1302- Just _ -> putChecker >> return False
1303- Nothing ->
1309+ -- case isSet ty of
1310+ -- Just _ -> putChecker >> return False
1311+ -- Nothing ->
13041312 putChecker >> return True
13051313
13061314instance Unifiable Substitutors where
Original file line number Diff line number Diff line change 1+ language GradedBase
2+
3+ data List a = Cons a (List a) | Nil
4+
5+ data Privilege = Camera | Contacts | Location | Microphone
6+
7+ getLocation : String [{Location}]
8+ getLocation = ["051.28°N 001.08°E"]
9+
10+ getContacts : (List String) [{Contacts}]
11+ getContacts = [Cons "Alice" (Cons "Bob" (Cons "Carol" Nil))]
12+
13+ non-example : (List String) [{Contacts}]
14+ non-example =
15+ let [location] : String [{Location}] = getLocation;
16+ [contacts] : (List String) [{Contacts}] = getContacts
17+ in [Cons location contacts]
You can’t perform that action at this time.
0 commit comments