From f6441b22921c6ae24840d60b80672d499ddaef33 Mon Sep 17 00:00:00 2001 From: aarne Date: Mon, 20 Oct 2014 20:06:46 +0000 Subject: [PATCH] use of 'head' in TypeCheck/RConcrete created an uncomprehensible error message. Now checking for the emptiness of the list concerned, so that the error can be found. --- src/compiler/GF/Compile/TypeCheck/RConcrete.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/GF/Compile/TypeCheck/RConcrete.hs b/src/compiler/GF/Compile/TypeCheck/RConcrete.hs index 67ff26115..9d987d965 100644 --- a/src/compiler/GF/Compile/TypeCheck/RConcrete.hs +++ b/src/compiler/GF/Compile/TypeCheck/RConcrete.hs @@ -386,7 +386,9 @@ getOverload gr g mt ot = case appForm ot of ---- "with argument types" <+> hsep (map (ppTerm Qualified 0) tys) $$ "resolved by selecting the first of the alternatives" $$ nest 2 (vcat [ppTerm Qualified 0 fun | (_,ty,fun) <- vfs1 ++ if null vfs1 then vfs2 else []]) - return $ head [(mkApp fun tts,val) | (val,fun) <- nps1 ++ nps2] + case [(mkApp fun tts,val) | (val,fun) <- nps1 ++ nps2] of + [] -> checkError $ "no alternatives left when resolving" <+> ppTerm Unqualified 0 f + h:_ -> return h matchVal mt v = elem mt [Nothing,Just v,Just (unlocked v)]