mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Crash resolving a method on Foo[2] when Foo is distinct #2042.
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
- `"+".to_float()` would panic.
|
||||
- `import` can now both be @public and @norecurse.
|
||||
- Crash when trying to convert a struct slice to a vector #2039.
|
||||
- Crash resolving a method on `Foo[2]` when `Foo` is distinct #2042.
|
||||
|
||||
### Stdlib changes
|
||||
- `new_*` functions in general moved to version without `new_` prefix.
|
||||
|
||||
@@ -1180,8 +1180,7 @@ static inline bool sema_analyse_signature(SemaContext *context, Signature *sig,
|
||||
if (method_parent && !vec_size(params))
|
||||
{
|
||||
RETURN_SEMA_ERROR(decl, "A method must start with an argument of the type "
|
||||
"it is a method of, e.g. 'fn void %s.%s(%s* self)', "
|
||||
"unless it is a 'construct' method,",
|
||||
"it is a method of, e.g. 'fn void %s.%s(%s* self)'.",
|
||||
type_to_error_string(method_parent->type), decl->name, type_to_error_string(method_parent->type));
|
||||
}
|
||||
|
||||
|
||||
@@ -480,7 +480,7 @@ static inline bool sema_resolve_type(SemaContext *context, TypeInfo *type_info,
|
||||
case TYPE_INFO_SLICE:
|
||||
case TYPE_INFO_ARRAY:
|
||||
case TYPE_INFO_VECTOR:
|
||||
if (!sema_resolve_array_type(context, type_info, resolve_kind))
|
||||
if (!sema_resolve_array_type(context, type_info, resolve_kind & ~RESOLVE_TYPE_NO_CHECK_DISTINCT))
|
||||
{
|
||||
return type_info_poison(type_info);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
module abc;
|
||||
distinct Foo = int;
|
||||
distinct Bar = int;
|
||||
fn void Foo[2].foo(&self) {}
|
||||
// Same with:
|
||||
macro Bar[2].bar(&self) {}
|
||||
|
||||
fn void main()
|
||||
{}
|
||||
Reference in New Issue
Block a user