mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Improve error message when providing alias with a typeid expression where a type was expected. #2944
This commit is contained in:
@@ -2421,8 +2421,12 @@ static inline Decl *parse_alias_type(ParseContext *c, AstId contracts)
|
||||
print_error_at(decl->span, "An identifier may not be aliased with type name, it must start with a lower case letter.");
|
||||
}
|
||||
return poisoned_decl;
|
||||
case EXPR_TERNARY:
|
||||
case EXPR_CALL:
|
||||
PRINT_ERROR_AT(expr, "Expected a type to alias here, if you are providing a constant typeid-expression, e.g. 'FOO > 32 ??? long : int', then you need to wrap the expression in '$typefrom'");
|
||||
return poisoned_decl;
|
||||
default:
|
||||
PRINT_ERROR_HERE("Expected a type to alias here.");
|
||||
PRINT_ERROR_AT(expr, "Expected the name of the type to alias here.");
|
||||
return poisoned_decl;
|
||||
}
|
||||
ASSERT(!tok_is(c, TOKEN_LBRACE));
|
||||
|
||||
Reference in New Issue
Block a user