mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
- Trying to slice an indexable type leads to misleading error message #2958
This commit is contained in:
@@ -48,6 +48,7 @@
|
|||||||
- On assert known false, the message was not show for no-args.
|
- On assert known false, the message was not show for no-args.
|
||||||
- Adding the incorrect sized vector to a pointer vector would cause a crash.
|
- Adding the incorrect sized vector to a pointer vector would cause a crash.
|
||||||
- Member access on a struct returned by the assignment expression, cause crash #2947
|
- Member access on a struct returned by the assignment expression, cause crash #2947
|
||||||
|
- Trying to slice an indexable type leads to misleading error message #2958
|
||||||
|
|
||||||
## 0.7.9 Change list
|
## 0.7.9 Change list
|
||||||
|
|
||||||
|
|||||||
@@ -4848,7 +4848,7 @@ static inline bool sema_expr_analyse_slice(SemaContext *context, Expr *expr)
|
|||||||
|
|
||||||
if (!inner_type || !type_is_valid_for_array(inner_type))
|
if (!inner_type || !type_is_valid_for_array(inner_type))
|
||||||
{
|
{
|
||||||
RETURN_SEMA_ERROR(subscripted, "Cannot index %s.", type_quoted_error_string(subscripted->type));
|
RETURN_SEMA_ERROR(subscripted, "You cannot slice %s.", type_quoted_error_string(subscripted->type));
|
||||||
}
|
}
|
||||||
if (current_expr != subscripted)
|
if (current_expr != subscripted)
|
||||||
{
|
{
|
||||||
|
|||||||
8
test/test_suite/arrays/slice_no_overload.c3
Normal file
8
test/test_suite/arrays/slice_no_overload.c3
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import std;
|
||||||
|
|
||||||
|
fn int main()
|
||||||
|
{
|
||||||
|
List {int} int_list;
|
||||||
|
int[] int_slice = int_list[..]; // #error: You cannot slice 'List{int}'
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user