add noreturn and unreachable

This commit is contained in:
2026-07-22 00:27:13 +02:00
parent 402871ef7a
commit 17508ff751
21 changed files with 286673 additions and 279245 deletions
+5
View File
@@ -1159,6 +1159,10 @@ ct_eval_expr :: proc(
return INVALID_CT_VALUE, ct_flow(.Normal), ct_fail(state, .Not_Comptime, expr.span, "'null' requires an optional context")
}
return ct_add_value(state, Ct_Value{kind=.Null, type=expected}), ct_flow(.Normal), true
case .Unreachable:
return INVALID_CT_VALUE, ct_flow(.Normal), ct_fail(
state, .Not_Comptime, expr.span, "reached unreachable code during comptime evaluation",
)
case .Field:
if enum_type, enum_ok := enum_type_from_field_expr(checker, expr, state.pkg, state.file); enum_ok {
member, ok := find_enum_member(checker, enum_type, expr.name)
@@ -2697,6 +2701,7 @@ ct_typeinfo_value :: proc(state: ^Ct_State, target: types.Type, span: source.Spa
tag := "invalid"
if !item_ok {
if types.is_void(resolved) { tag = "void" }
else if types.is_noreturn(resolved) { tag = "noreturn" }
else if types.is_anyopaque(resolved) { tag = "anyopaque" }
else if types.is_bool(resolved) { tag = "bool" }
else if types.is_concrete_integer(resolved) { tag = "integer" }