From 761b89d690cc9d4d3756cf89e79ee14cd732c106 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 14 Nov 2025 15:04:30 +0100 Subject: [PATCH] yet another variation of the overloading error --- src/compiler/api/GF/Compile/TypeCheck/Concrete.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/compiler/api/GF/Compile/TypeCheck/Concrete.hs b/src/compiler/api/GF/Compile/TypeCheck/Concrete.hs index 80c71ac8c..733b8eb23 100644 --- a/src/compiler/api/GF/Compile/TypeCheck/Concrete.hs +++ b/src/compiler/api/GF/Compile/TypeCheck/Concrete.hs @@ -659,12 +659,16 @@ resolveOverloads scope c t0 q args mb_ty = do minimum g ttys0 arg_tys [] = (maxBound,err) where - err = evalError ("Overload resolution failed" $$ - "of term " <+> pp (foldl App (Q q) args) $$ - "with alternatives" $$ - nest 4 (vcat [pp (snd q) <+> pp ':' <+> ppTerm Terse 0 ty | (_,ty) <- ttys0]) $$ + err = evalError ("no overload instance in the term" $$ + nest 4 (pp (foldl App (Q q) args)) $$ + (case mb_ty of + Just vty -> pp "with value type" $$ + nest 4 (ppValue Unqualified 0 vty) + Nothing -> empty) $$ "and argument types" $$ - nest 4 (fsep (punctuate (pp ',') [ppValue Terse 0 ty | (_,_,ty) <- arg_tys]))) + nest 4 (fsep (punctuate (pp ',') [ppValue Terse 0 ty | (_,_,ty) <- arg_tys])) $$ + "among alternatives" $$ + nest 4 (vcat [pp (snd q) <+> pp ':' <+> ppTerm Terse 0 ty | (_,ty) <- ttys0])) minimum g ttys0 arg_tys (tty@(t,ty):ttys) = let a = arity ty