Skip to content

Commit

Permalink
enable recursion for Geb
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Mar 30, 2023
1 parent a2591e5 commit 2c36358
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Juvix/Compiler/Backend/Geb/Pretty/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ instance PrettyCode Binop where

instance PrettyCode Failure where
ppCode Failure {..} = do
ty <- ppCode _failureType
ty <- ppArg _failureType
return $ kwFail <+> ppStringLit _failureMessage <+> ty

instance PrettyCode Var where
Expand Down
14 changes: 1 addition & 13 deletions src/Juvix/Compiler/Core/Transformation/CheckGeb.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module Juvix.Compiler.Core.Transformation.CheckGeb where

import Data.HashMap.Strict qualified as HashMap
import Juvix.Compiler.Core.Data.IdentDependencyInfo
import Juvix.Compiler.Core.Data.TypeDependencyInfo
import Juvix.Compiler.Core.Error
import Juvix.Compiler.Core.Extra
Expand All @@ -12,8 +11,7 @@ import Juvix.Data.PPOutput

checkGeb :: forall r. Member (Error CoreError) r => InfoTable -> Sem r InfoTable
checkGeb tab =
checkNoRecursion
>> checkNoRecursiveTypes
checkNoRecursiveTypes
>> mapAllNodesM checkNoIO tab
>> mapAllNodesM checkBuiltins tab
>> mapAllNodesM checkTypes tab
Expand Down Expand Up @@ -82,16 +80,6 @@ checkGeb tab =
_ -> return node
_ -> return node

checkNoRecursion :: Sem r ()
checkNoRecursion =
when (isCyclic (createIdentDependencyInfo tab)) $
throw
CoreError
{ _coreErrorMsg = ppOutput "recursion not supported for the GEB target",
_coreErrorNode = Nothing,
_coreErrorLoc = defaultLoc
}

checkNoRecursiveTypes :: Sem r ()
checkNoRecursiveTypes =
when (isCyclic (createTypeDependencyInfo tab)) $
Expand Down

0 comments on commit 2c36358

Please sign in to comment.