From f9b27b38bbbac7f07b1cd778b1278142d95816b8 Mon Sep 17 00:00:00 2001 From: Frames White Date: Thu, 4 Jan 2024 19:14:51 +0800 Subject: [PATCH] Print type signature for what was inferring whenever an internal error is thrown (#52695) --- src/gf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gf.c b/src/gf.c index 268927f60172e..7dd251ff9b746 100644 --- a/src/gf.c +++ b/src/gf.c @@ -388,14 +388,15 @@ jl_code_info_t *jl_type_infer(jl_method_instance_t *mi, size_t world, int force) } JL_CATCH { jl_value_t *e = jl_current_exception(); + jl_printf((JL_STREAM*)STDERR_FILENO, "Internal error: during type inference of\n"); + jl_static_show_func_sig((JL_STREAM*)STDERR_FILENO, (jl_value_t*)mi->specTypes); + jl_printf((JL_STREAM*)STDERR_FILENO, "\nEncountered "); if (e == jl_stackovf_exception) { - jl_printf((JL_STREAM*)STDERR_FILENO, "Internal error: stack overflow in type inference of "); - jl_static_show_func_sig((JL_STREAM*)STDERR_FILENO, (jl_value_t*)mi->specTypes); - jl_printf((JL_STREAM*)STDERR_FILENO, ".\n"); + jl_printf((JL_STREAM*)STDERR_FILENO, "stack overflow.\n"); jl_printf((JL_STREAM*)STDERR_FILENO, "This might be caused by recursion over very long tuples or argument lists.\n"); } else { - jl_printf((JL_STREAM*)STDERR_FILENO, "Internal error: encountered unexpected error in runtime:\n"); + jl_printf((JL_STREAM*)STDERR_FILENO, "unexpected error in runtime:\n"); jl_static_show((JL_STREAM*)STDERR_FILENO, e); jl_printf((JL_STREAM*)STDERR_FILENO, "\n"); jlbacktrace(); // written to STDERR_FILENO