From bf7c92bf0909aaf49a8590570085e1c6a1787d00 Mon Sep 17 00:00:00 2001 From: Tohei Ichikawa Date: Sat, 10 Jan 2026 03:02:25 -0500 Subject: [PATCH 1/2] Fix assertion error when imported proc groups are passed as proc arguments --- src/check_expr.cpp | 6 +++++- tests/internal/test_imported_proc_groups.odin | 10 ++++++++++ .../internal/test_imported_proc_groups/proc_group.odin | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/internal/test_imported_proc_groups.odin create mode 100644 tests/internal/test_imported_proc_groups/proc_group.odin diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 2b2ae09cc..60fae74c6 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -1133,7 +1133,11 @@ gb_internal void check_assignment(CheckerContext *c, Operand *operand, Type *typ x.mode = Addressing_Value; x.type = t; if (check_is_assignable_to(c, &x, type)) { - add_entity_use(c, operand->expr, e); + if (operand->expr->kind == Ast_SelectorExpr) { + add_entity_use(c, operand->expr->SelectorExpr.selector, e); + } else { + add_entity_use(c, operand->expr, e); + } good = true; break; } diff --git a/tests/internal/test_imported_proc_groups.odin b/tests/internal/test_imported_proc_groups.odin new file mode 100644 index 000000000..3f5b01fb3 --- /dev/null +++ b/tests/internal/test_imported_proc_groups.odin @@ -0,0 +1,10 @@ +package test_internal + +import "core:testing" +import "test_imported_proc_groups" + +@test +test_ :: proc(t: ^testing.T) { + use_proc :: proc(proc()) { } + use_proc(test_imported_proc_groups.proc_group) +} diff --git a/tests/internal/test_imported_proc_groups/proc_group.odin b/tests/internal/test_imported_proc_groups/proc_group.odin new file mode 100644 index 000000000..59519ab9c --- /dev/null +++ b/tests/internal/test_imported_proc_groups/proc_group.odin @@ -0,0 +1,4 @@ +package test_imported_proc_groups + +proc_group :: proc{empty_proc} +empty_proc :: proc() { } From c8f2603d3eb6f47ab772f83ecd0a5758d18e7b59 Mon Sep 17 00:00:00 2001 From: Tohei Ichikawa Date: Sat, 10 Jan 2026 03:35:33 -0500 Subject: [PATCH 2/2] Fix test name, add PR link, use tabs --- tests/internal/test_imported_proc_groups.odin | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/internal/test_imported_proc_groups.odin b/tests/internal/test_imported_proc_groups.odin index 3f5b01fb3..e91af4bf5 100644 --- a/tests/internal/test_imported_proc_groups.odin +++ b/tests/internal/test_imported_proc_groups.odin @@ -3,8 +3,9 @@ package test_internal import "core:testing" import "test_imported_proc_groups" +// https://github.com/odin-lang/Odin/pull/6119 @test -test_ :: proc(t: ^testing.T) { - use_proc :: proc(proc()) { } - use_proc(test_imported_proc_groups.proc_group) +test_use_imported_proc_group_as_argument :: proc(t: ^testing.T) { + use_proc :: proc(proc()) { } + use_proc(test_imported_proc_groups.proc_group) }