Fix issue where type wasn't canonical. Addresses #957

This commit is contained in:
Christoffer Lerno
2023-08-27 19:04:34 +02:00
parent cc2c737357
commit 6ebb3caa20
3 changed files with 9 additions and 2 deletions

View File

@@ -310,6 +310,10 @@ fn void Object.set_object_at(&self, usz index, Object* to_set)
self.array.set_at(index, 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)
{
if (value.is_float())
@@ -328,8 +332,10 @@ macro get_integer_value(Object* value, $Type)
return ($Type)value.i;
}
/**
* @require self.is_indexable()
* @require $Type.kindof.is_int() : "Expected an integer type"
**/
macro Object.get_integer_at(&self, $Type, usz index) @private
{
@@ -338,6 +344,7 @@ macro Object.get_integer_at(&self, $Type, usz index) @private
/**
* @require self.is_keyable()
* @require $Type.kindof.is_int() : "Expected an integer type"
**/
macro Object.get_integer(&self, $Type, String key) @private
{

View File

@@ -3064,7 +3064,7 @@ static inline bool sema_expr_analyse_member_access(SemaContext *context, Expr *e
return true;
case TYPE_PROPERTY_KINDOF:
case TYPE_PROPERTY_SIZEOF:
return sema_expr_rewrite_to_type_property(context, expr, decl->type, type_property, decl->type);
return sema_expr_rewrite_to_type_property(context, expr, decl->type->canonical, type_property, decl->type->canonical);
case TYPE_PROPERTY_ELEMENTS:
case TYPE_PROPERTY_EXTNAMEOF:
case TYPE_PROPERTY_PARAMS:

View File

@@ -1 +1 @@
#define COMPILER_VERSION "0.4.620"
#define COMPILER_VERSION "0.4.621"