mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Improved error message on invalid subscript index type #1535.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
- Deprecate `@adhoc`, allow non-nested ad hoc generic types.
|
||||
- Constant bytes <=> char[] conversion should work #1514.
|
||||
- Infer now works across ternary.
|
||||
- Improved error message on invalid subscript index type #1535.
|
||||
|
||||
### Fixes
|
||||
- `Unsupported int[*] $x = { 1, 2, 3, 4 }` #1489.
|
||||
|
||||
@@ -629,14 +629,8 @@ bool cast_to_index(SemaContext *context, Expr *index, Type *subscripted_type)
|
||||
type = type->decl->enums.type_info->type;
|
||||
goto RETRY;
|
||||
default:
|
||||
if (!subscripted_type)
|
||||
{
|
||||
RETURN_SEMA_ERROR(index, "Cannot implicitly convert %s to an index.",
|
||||
type_quoted_error_string(index->type));
|
||||
}
|
||||
RETURN_SEMA_ERROR(index, "Cannot implicitly convert %s to index %s.",
|
||||
type_quoted_error_string(index->type),
|
||||
type_quoted_error_string(subscripted_type));
|
||||
RETURN_SEMA_ERROR(index, "An integer value was expected here, but it is a value of type %s, which can't be implicitly converted into an integer index.",
|
||||
type_quoted_error_string(index->type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user