mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-06 06:38:20 +00:00
Merge pull request #6488 from harold-b/hb.fix-double-when-in-foreign
Fixes #6484 : Two `when` blocks which evaluate to `true` in a `foreign` block misses following decls
This commit is contained in:
@@ -6027,8 +6027,8 @@ gb_internal void check_import_entities(Checker *c) {
|
||||
}
|
||||
|
||||
TIME_SECTION("check_import_entities - check delayed entities");
|
||||
for_array(i, package_order) {
|
||||
ImportGraphNode *node = package_order[i];
|
||||
for (isize pkg_index = 0; pkg_index < package_order.count; pkg_index++) {
|
||||
ImportGraphNode *node = package_order[pkg_index];
|
||||
GB_ASSERT(node->scope->flags&ScopeFlag_Pkg);
|
||||
AstPackage *pkg = node->scope->pkg;
|
||||
|
||||
@@ -6054,9 +6054,20 @@ gb_internal void check_import_entities(Checker *c) {
|
||||
reset_checker_context(&ctx, f, &untyped);
|
||||
|
||||
ctx.collect_delayed_decls = true;
|
||||
|
||||
bool will_recheck_foreign_block = false;
|
||||
for (Ast *decl : f->delayed_decls_queues[AstDelayQueue_ForeignBlock]) {
|
||||
check_add_foreign_block_decl(&ctx, decl);
|
||||
if (check_add_foreign_block_decl(&ctx, decl)) {
|
||||
pkg_index -= 1; // Re-check package
|
||||
will_recheck_foreign_block = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (will_recheck_foreign_block) {
|
||||
break;
|
||||
}
|
||||
|
||||
array_clear(&f->delayed_decls_queues[AstDelayQueue_ForeignBlock]);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ set COMMON=-define:ODIN_TEST_FANCY=false -file -vet -strict-style -ignore-unused
|
||||
..\..\..\odin test ..\test_pr_6470.odin %COMMON% || exit /b
|
||||
..\..\..\odin test ..\test_pr_6470.odin -define:TEST_EXPECT_FAILURE=true %COMMON% 2>&1 | find /c "Error:" | findstr /x "1" || exit /b
|
||||
..\..\..\odin test ..\test_pr_6476.odin %COMMON% || exit /b
|
||||
..\..\..\odin check ..\test_issue_6484.odin -no-entry-point %COMMON% || exit /b
|
||||
|
||||
@echo off
|
||||
|
||||
|
||||
@@ -58,6 +58,8 @@ else
|
||||
echo "SUCCESSFUL 0/1"
|
||||
exit 1
|
||||
fi
|
||||
$ODIN check ../test_issue_6484.odin -no-entry-point $COMMON
|
||||
|
||||
set +x
|
||||
|
||||
popd
|
||||
|
||||
17
tests/issues/test_issue_6484.odin
Normal file
17
tests/issues/test_issue_6484.odin
Normal file
@@ -0,0 +1,17 @@
|
||||
// Tests issue #6484 https://github.com/odin-lang/Odin/pull/6484
|
||||
package test_issues
|
||||
|
||||
foreign import lib "this_library_does_not_exist"
|
||||
|
||||
foreign lib {
|
||||
foo :: proc(int) ---
|
||||
when true {}
|
||||
when true {}
|
||||
bar :: proc() ---
|
||||
}
|
||||
|
||||
foo_bar :: proc {
|
||||
foo,
|
||||
bar,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user