From 96f1069e4a615e0857d9443fe5af639e3b2dd46a Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 26 Jan 2026 18:29:39 +0000 Subject: [PATCH] Fix `type_assertion_check2*` for `-no-rtti` --- base/runtime/error_checks.odin | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/base/runtime/error_checks.odin b/base/runtime/error_checks.odin index 79245fc0c..34f51ab8e 100644 --- a/base/runtime/error_checks.odin +++ b/base/runtime/error_checks.odin @@ -170,11 +170,14 @@ when ODIN_NO_RTTI { return } @(cold, no_instrumentation) - handle_error :: proc "contextless" (file: string, line, column: i32) -> ! { - print_caller_location(Source_Code_Location{file, line, column, ""}) - print_string(" Invalid type assertion\n") - type_assertion_trap() + handle_error :: proc "odin" (file: string, line, column: i32) -> ! { + p := context.assertion_failure_proc + if p == nil { + p = default_assertion_failure_proc + } + p("type assertion", "Invalid type assertion", Source_Code_Location{file, line, column, ""}) } + handle_error(file, line, column) } @@ -183,12 +186,10 @@ when ODIN_NO_RTTI { return } @(cold, no_instrumentation) - handle_error :: proc "odin" (file: string, line, column: i32) -> ! { - p := context.assertion_failure_proc - if p == nil { - p = default_assertion_failure_proc - } - p("type assertion", "Invalid type assertion", Source_Code_Location{file, line, column, ""}) + handle_error :: proc "contextless" (file: string, line, column: i32) -> ! { + print_caller_location(Source_Code_Location{file, line, column, ""}) + print_string(" Invalid type assertion\n") + type_assertion_trap() } handle_error(file, line, column) }