mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Remove null-casts for anyerr.
This commit is contained in:
@@ -1004,13 +1004,6 @@ static bool cast_from_pointer(SemaContext *context, Expr *expr, Type *from, Type
|
||||
return cast_with_optional(expr, to_type, add_optional);
|
||||
}
|
||||
return sema_error_cannot_convert(expr, to_type, true, silent);
|
||||
case TYPE_FAULTTYPE:
|
||||
case TYPE_ANYERR:
|
||||
if (expr_is_const_pointer(expr) && !expr->const_expr.ptr)
|
||||
{
|
||||
expr_rewrite_to_const_zero(expr, to_type);
|
||||
return true;
|
||||
}
|
||||
case TYPE_OPTIONAL_ANY:
|
||||
case TYPE_OPTIONAL:
|
||||
UNREACHABLE
|
||||
|
||||
@@ -8,11 +8,11 @@ fault Foo
|
||||
|
||||
fn void ordinals()
|
||||
{
|
||||
Foo z = null;
|
||||
Foo z = {};
|
||||
assert(z.ordinal == 0);
|
||||
$assert(Foo.ABC.ordinal == 1);
|
||||
$assert(Foo.CDE.ordinal == 2);
|
||||
$assert(((Foo)null).ordinal == 0);
|
||||
$assert((Foo{}).ordinal == 0);
|
||||
Foo x = Foo.CDE;
|
||||
assert(x.ordinal == 2);
|
||||
x = Foo.ABC;
|
||||
|
||||
Reference in New Issue
Block a user