$typeof(<type>) returns typeinfo, causing errors #2795

This commit is contained in:
Christoffer Lerno
2026-01-22 20:04:09 +01:00
parent 32675161c4
commit bf50178eb3
4 changed files with 10 additions and 2 deletions

View File

@@ -6900,7 +6900,6 @@ static inline bool sema_expr_analyse_cast(SemaContext *context, Expr *expr, bool
{
RETURN_SEMA_ERROR(type_info, "Casting to an optional type is not allowed.");
}
if (invalid_cast_ref)
{
if (!cast_explicit_silent(context, inner, target_type))

View File

@@ -341,10 +341,12 @@ INLINE bool sema_resolve_typeof(SemaContext *context, TypeInfo *type_info)
{
case STORAGE_ERROR:
return false;
case STORAGE_COMPILE_TIME:
if (expr_type->type_kind == TYPE_TYPEINFO) expr_type = type_typeid;
FALLTHROUGH;
case STORAGE_NORMAL:
case STORAGE_VOID:
case STORAGE_UNKNOWN:
case STORAGE_COMPILE_TIME:
type_info->type = expr_type;
return true;
case STORAGE_WILDCARD: