bug fixes

This commit is contained in:
2026-07-13 23:34:14 +02:00
parent 0eeacc2e37
commit 0b0b00a050
6 changed files with 114 additions and 17 deletions
+9
View File
@@ -2196,6 +2196,11 @@ ct_eval_template_call :: proc(
result := ct_add_value(state, Ct_Value{kind=.Void, type=types.VOID})
return result, ct_flow(.Normal), true
}
if flow.kind == .Normal && types.kind(result_type, &checker.module.types) == .Fallible &&
types.is_void(types.fallible_success(result_type, &checker.module.types)) {
result := ct_make_fallible(state, result_type, INVALID_CT_VALUE, false)
return result, ct_flow(.Normal), true
}
return INVALID_CT_VALUE, ct_flow(.Normal), ct_failf(state, .Not_Comptime, span, "comptime function '%s' did not return a value", symbol_text(checker, function.name))
}
result := flow.value
@@ -2304,6 +2309,10 @@ ct_eval_catch_expr :: proc(state: ^Ct_State, expr: ast.Expr, expected: types.Typ
}
return handler.value, ct_flow(.Normal), true
}
if handler.kind == .Normal && types.is_void(success) {
value := ct_add_value(state, Ct_Value{kind=.Void, type=types.VOID})
return value, ct_flow(.Normal), true
}
return INVALID_CT_VALUE, handler, ct_fail(state, .Not_Comptime, expr.span, "catch block must yield a value")
}