preserve active comptime state in local type declarations

This commit is contained in:
2026-07-21 22:48:16 +02:00
parent dd00af7731
commit 1619ea98a3
3 changed files with 8 additions and 9 deletions
+2 -2
View File
@@ -3873,7 +3873,7 @@ ct_exec_statements :: proc(
ok = value_ok
if ok && value_flow.kind == .Yield {
value := value_flow.value
declared := type_from_syntax(checker, statement.type, state.pkg, state.file)
declared := type_from_syntax(checker, statement.type, state.pkg, state.file, active_state=state)
if types.is_valid(declared) && !types.is_void(declared) {
value, ok = ct_coerce_value(state, value, declared, statement.span)
}
@@ -3884,7 +3884,7 @@ ct_exec_statements :: proc(
ok = ct_fail(state, .Not_Comptime, statement.span, "comptime value block must yield")
}
} else {
declared := type_from_syntax(checker, statement.type, state.pkg, state.file)
declared := type_from_syntax(checker, statement.type, state.pkg, state.file, active_state=state)
expected := declared if types.is_valid(declared) && !types.is_void(declared) else types.INVALID
value, expr_flow, expr_ok := ct_eval_expr(state, statement.expr, expected, depth+1)
ok = expr_ok