mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Improve error message when using void aliases as variable storage type.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
- Null-check function pointer invocation #1573.
|
||||
- `string::new_struct_to_str` and `io::struct_to_format` to dump struct data.
|
||||
- `io::print` will now print structs.
|
||||
- Improve error message when using `void` aliases as variable storage type.
|
||||
|
||||
### Fixes
|
||||
- `Unsupported int[*] $x = { 1, 2, 3, 4 }` #1489.
|
||||
|
||||
@@ -3666,11 +3666,12 @@ static bool sema_analyse_variable_type(SemaContext *context, Type *type, SourceS
|
||||
case STORAGE_WILDCARD:
|
||||
if (type_is_optional(type))
|
||||
{
|
||||
RETURN_SEMA_ERROR_AT(span, "The use of 'void!' as a variable type is not permitted, "
|
||||
RETURN_SEMA_ERROR_AT(span, "The use of %s as a variable type is not permitted, "
|
||||
"catch the error using 'if (catch err = foo) { ... }',"
|
||||
" or use '@catch(foo)' to convert it to an 'anyfault'.");
|
||||
" or use '@catch(foo)' to convert it to an 'anyfault'.",
|
||||
type_quoted_error_string(type));
|
||||
}
|
||||
RETURN_SEMA_ERROR_AT(span, "The use of 'void' as a variable type is not permitted.");
|
||||
RETURN_SEMA_ERROR_AT(span, "The use of %s as a variable type is not permitted.", type_quoted_error_string(type));
|
||||
case STORAGE_COMPILE_TIME:
|
||||
RETURN_SEMA_ERROR_AT(span, "The variable cannot have an compile time %s type.",
|
||||
type_quoted_error_string(type));
|
||||
|
||||
Reference in New Issue
Block a user