preserve global resolved type properly

This commit is contained in:
2026-07-20 16:10:05 +02:00
parent 05aa7d084a
commit ad4802a270
2 changed files with 5 additions and 2 deletions
+3 -2
View File
@@ -6555,11 +6555,12 @@ prune_specs :: proc(checker: ^Checker) {
if checker.entry_point == .Process {
mark_spec_demanded(checker, find_spec(checker, checker.io_provider_template, nil), &stack)
}
for global in checker.ast_module.globals {
for global, index in checker.ast_module.globals {
if global.external || global.diagnostic != source.INVALID_DIAGNOSTIC {
continue
}
_ = infer_expr(checker, global.expr, nil, global.pkg, global.file, &stack)
expected := checker.global_types[index] if is_runtime_type(checker, checker.global_types[index]) else types.INVALID
_ = infer_expr(checker, global.expr, nil, global.pkg, global.file, &stack, expected=expected)
}
for len(stack) > 0 {
id := pop(&stack)
+2
View File
@@ -10,6 +10,8 @@ State :: struct {
diagnostics std.ArrayList(ScanDiagnostic)
}
arrlist_test std.ArrayList(Token) = arraylist.init(mem.c_allocator)
hide fail_alloc func(_ ?@mut anyopaque, _ usize, _ usize) ?*mut u8 {
return none
}