mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Instantiating an alias of a user-defined type was not properly caught #2798
This commit is contained in:
@@ -101,6 +101,7 @@
|
||||
- Casting const bytes to vector with different element size was broken #2787
|
||||
- Unable to access fields of a const inline enum with an aggregate underlying type. #2802
|
||||
- Using an optional type as generic parameter was not properly caught #2799
|
||||
- Instantiating an alias of a user-defined type was not properly caught #2798
|
||||
|
||||
### Stdlib changes
|
||||
- Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads.
|
||||
|
||||
@@ -442,15 +442,15 @@ INLINE bool sema_resolve_generic_type(SemaContext *context, TypeInfo *type_info)
|
||||
{
|
||||
RETURN_SEMA_ERROR(inner, "Parameterization required a concrete type name here.");
|
||||
}
|
||||
if (inner->resolve_status == RESOLVE_DONE)
|
||||
switch (inner->resolve_status)
|
||||
{
|
||||
if (!type_is_user_defined(inner->type))
|
||||
{
|
||||
RETURN_SEMA_ERROR(inner, "A user defined type was expected here, not %s.", type_quoted_error_string(inner->type));
|
||||
}
|
||||
case RESOLVE_DONE:
|
||||
RETURN_SEMA_ERROR(inner, "A user-defined generic type was expected here, but the type was %s.", type_quoted_error_string(inner->type));
|
||||
case RESOLVE_RUNNING:
|
||||
RETURN_SEMA_ERROR(inner, "Resolving the type %s entered a recursive loop.", type_quoted_error_string(inner->type));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ASSERT_SPAN(inner, inner->resolve_status == RESOLVE_NOT_DONE);
|
||||
|
||||
bool was_recursive = false;
|
||||
if (compiler.generic_depth >= MAX_GENERIC_DEPTH)
|
||||
{
|
||||
|
||||
9
test/test_suite/generic/generic_instantiate_alias.c3
Normal file
9
test/test_suite/generic/generic_instantiate_alias.c3
Normal file
@@ -0,0 +1,9 @@
|
||||
import std;
|
||||
fn void a()
|
||||
{
|
||||
usz{} i = Z; // #error: A user-defined generic type was expected here, but the type was 'usz' (ulong)
|
||||
}
|
||||
fn int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user