Skip to content

Commit

Permalink
respect --no-positivity
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Sep 28, 2024
1 parent e895301 commit a34aff1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ checkPositivity ::
]
r
) =>
Bool ->
MutualBlock ->
Sem r ()
checkPositivity mut = do
checkPositivity noPositivityFlag mut = do
let ldefs :: [InductiveDef] =
mut
^.. mutualStatements
Expand Down Expand Up @@ -86,9 +87,14 @@ checkPositivity mut = do
addPolarities (defName ^. nameId) polarities
poltab' <- (^. typeCheckingTablesPolarityTable) <$> getCombinedTables
let names :: NonEmpty InductiveName = (^. inductiveName) <$> defs
checkStrictlyPositive poltab' names occ
unless noPositivityFlag (checkStrictlyPositive poltab' names occ)

checkStrictlyPositive :: (Members '[Error TypeCheckerError] r) => PolarityTable -> NonEmpty InductiveName -> Occurrences -> Sem r ()
checkStrictlyPositive ::
(Members '[Error TypeCheckerError] r) =>
PolarityTable ->
NonEmpty InductiveName ->
Occurrences ->
Sem r ()
checkStrictlyPositive tbl mutual = runReader PolarityStrictlyPositive . go
where
getPolarities :: InductiveName -> [Polarity]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ checkModule ::
Module ->
Sem r Module
checkModule Module {..} = runReader (mempty @InsertedArgsStack) $ do
_moduleBody' <-
checkModuleBody $
_moduleBody
_moduleBody' <- checkModuleBody _moduleBody
return
Module
{ _moduleBody = _moduleBody',
Expand Down Expand Up @@ -264,13 +262,16 @@ checkBlockPositivity ::
'[ Reader InfoTable,
Error TypeCheckerError,
ResultBuilder,
Reader EntryPoint,
Inference
]
r
) =>
MutualBlock ->
Sem r ()
checkBlockPositivity = New.checkPositivity
checkBlockPositivity m = do
noPos <- asks (^. entryPointNoPositivity)
New.checkPositivity noPos m

resolveCastHoles ::
forall a r.
Expand Down

0 comments on commit a34aff1

Please sign in to comment.