Skip to content

Commit

Permalink
fix: Infinite loop when evaluating (()) (carp-lang#1427)
Browse files Browse the repository at this point in the history
Evaluation of `(())` is treated as a malformed expression
rather than causing an infinite loop
  • Loading branch information
Gavinok committed Feb 2, 2023
1 parent ca5774b commit 84bfdcf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ eval ctx xobj@(XObj o info ty) preference resolver =
evaluateApp :: Evaluator
evaluateApp (AppPat f' args) =
case f' of
(ListPat []) -> pure (evalError ctx (format (GenericMalformed xobj)) (xobjInfo xobj))
l@(ListPat _) -> go l ResolveLocal
sym@(SymPat _ _) -> go sym resolver
_ -> pure (evalError ctx (format (GenericMalformed xobj)) (xobjInfo xobj))
Expand Down

0 comments on commit 84bfdcf

Please sign in to comment.