|
@@ -629,6 +629,9 @@ gb_internal i64 check_distance_between_types(CheckerContext *c, Operand *operand
|
|
|
|
|
|
if (operand->mode == Addressing_Type) {
|
|
if (operand->mode == Addressing_Type) {
|
|
if (is_type_typeid(type)) {
|
|
if (is_type_typeid(type)) {
|
|
|
|
+ if (is_type_polymorphic(operand->type)) {
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
add_type_info_type(c, operand->type);
|
|
add_type_info_type(c, operand->type);
|
|
return 4;
|
|
return 4;
|
|
}
|
|
}
|
|
@@ -1118,10 +1121,17 @@ gb_internal void check_assignment(CheckerContext *c, Operand *operand, Type *typ
|
|
LIT(context_name));
|
|
LIT(context_name));
|
|
break;
|
|
break;
|
|
case Addressing_Type:
|
|
case Addressing_Type:
|
|
- error(operand->expr,
|
|
|
|
- "Cannot assign '%s' which is a type in %.*s",
|
|
|
|
- op_type_str,
|
|
|
|
- LIT(context_name));
|
|
|
|
|
|
+ if (is_type_polymorphic(operand->type)) {
|
|
|
|
+ error(operand->expr,
|
|
|
|
+ "Cannot assign '%s' which is a polymorphic type in %.*s",
|
|
|
|
+ op_type_str,
|
|
|
|
+ LIT(context_name));
|
|
|
|
+ } else {
|
|
|
|
+ error(operand->expr,
|
|
|
|
+ "Cannot assign '%s' which is a type in %.*s",
|
|
|
|
+ op_type_str,
|
|
|
|
+ LIT(context_name));
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
// TODO(bill): is this a good enough error message?
|
|
// TODO(bill): is this a good enough error message?
|