aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-09-04 14:00:27 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-09-04 14:00:27 +0100
commita86031403d792792b41d8ae3795e3281b8876c63 (patch)
treed8ec50b5041d603f0cbeec7e26c8a29295b0117b /src
parent72dc8f0490a26c2438b5eff9fe29a3197036d6e5 (diff)
downloadmicro-lang-hs-a86031403d792792b41d8ae3795e3281b8876c63.tar.gz
micro-lang-hs-a86031403d792792b41d8ae3795e3281b8876c63.zip
Revert "Unneeded (duplicated) case"
It is actually needed because when we resolve the parameters it is possible some of them are wrong and we may end with a number of "right" that is less than the number of parameters we had initially. This reverts commit 72dc8f0490a26c2438b5eff9fe29a3197036d6e5.
Diffstat (limited to 'src')
-rw-r--r--src/Compiler.hs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/Compiler.hs b/src/Compiler.hs
index 1dfe4d9..0511644 100644
--- a/src/Compiler.hs
+++ b/src/Compiler.hs
@@ -49,6 +49,7 @@ typecheckCall args params
targs <- fmap rights $ traverse compile args
case sequence targs of
Just t
+ | length t /= length params -> return $ Nothing
| all (\(a, b) -> a == b) $ zip t params -> -- compare types
return $ Nothing -- all good!
| otherwise -> return $ Just ("type mismatch in function call\n found: " ++ A.showList t ++ "\n expected: " ++ A.showList params)