From 1430483a317081b849d6e750203ce3e04274793e Mon Sep 17 00:00:00 2001 From: Arnaud BOEGLIN Date: Sat, 8 Jun 2024 22:29:11 +0200 Subject: [PATCH] feat: start recovering errors locally instead of at the top level Goal is to keep as much information as possible about local types to improve the language server --- compiler/main/Infer/Exp.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/main/Infer/Exp.hs b/compiler/main/Infer/Exp.hs index 7de7a531..56a6b25d 100644 --- a/compiler/main/Infer/Exp.hs +++ b/compiler/main/Infer/Exp.hs @@ -319,7 +319,13 @@ inferApp options env (Can.Canonical area (Can.App abs@(Can.Canonical absArea _) else arg - s3 <- contextualUnify env expForContext (apply s2 t1) (apply s1 t2 `fn` tv) + s3 <- catchError + (contextualUnify env expForContext (apply s2 t1) (apply s1 t2 `fn` tv)) + (\err -> do + pushError err + unify (getReturnType t1) tv + ) + let t = apply s3 tv let s = s3 `compose` s2 `compose` s1