$and, $or, $is_const, $assignable, .is_eq, .is_ordered, $defined($vatype(2)) works looking if we can create a type, $defined(foo[0]) $defined(foo()). Remove $checks and @checked. Improvide casting checks to always work without destructive changes.

This commit is contained in:
Christoffer Lerno
2023-10-23 00:21:11 +02:00
committed by Christoffer Lerno
parent 8a12dc5bd4
commit 9af37fe427
46 changed files with 1149 additions and 801 deletions

View File

@@ -217,7 +217,7 @@ macro Object* Object.object_from_value(&self, value) @private
$case $Type.typeid == void*.typeid:
if (value != null) return CastResult.TYPE_MISMATCH?;
return &NULL_OBJECT;
$case $checks(String s = value):
$case $assignable(value, String):
return new_string(value, self.allocator);
$default:
$error "Unsupported object type.";
@@ -307,7 +307,6 @@ fn void Object.set_object_at(&self, usz index, Object* to_set)
/**
* @require $Type.kindof.is_int() "Expected an integer type."
* @checked ($Type)1.0 "Expected an integer type."
**/
macro get_integer_value(Object* value, $Type)
{