Merge pull request #610 from hellerve/master

Disallow non-symbols in fn arguments
This commit is contained in:
Erik Svedäng 2019-10-30 10:38:52 +01:00 committed by GitHub
commit 8e8fce0744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,6 +147,11 @@ eval env xobj =
_ -> return (makeEvalError ctx Nothing ("`if` condition contains non-boolean value: " ++ pretty okCondition) (info okCondition))
Left err -> return (Left err)
[XObj (Fn _ _) _ _, args@(XObj (Arr a) _ _), _] ->
if all isUnqualifiedSym a
then return (Right listXObj)
else return (makeEvalError ctx Nothing ("`fn` requires all arguments to be unqualified symbols, but it got `" ++ pretty args ++ "`") (info xobj))
[defnExpr@(XObj Defn _ _), name, args@(XObj (Arr a) _ _), body] ->
case obj name of
(Sym (SymPath [] _) _) ->