Tweak the error message on unexpectedly getting a non-type identifier. #1622

This commit is contained in:
Christoffer Lerno
2024-11-14 00:19:17 +01:00
parent 758918c077
commit f88c0dd645
2 changed files with 9 additions and 2 deletions

View File

@@ -477,7 +477,14 @@ static inline TypeInfo *parse_base_type(ParseContext *c)
default:
if (c->tok == TOKEN_IDENT)
{
PRINT_ERROR_HERE("A type name was expected, but this looks a variable or function name (as it doesn't start with an uppercase letter).");
if (peek(c) == TOKEN_IDENT)
{
PRINT_ERROR_HERE("The name of a type must start with uppercase and contain at least one lowercase letter.");
}
else
{
PRINT_ERROR_HERE("A type name was expected, but this looks a variable or function name (as it doesn't start with an uppercase letter).");
}
}
else
{

View File

@@ -1,4 +1,4 @@
func1 a = 1; // #error: A type name was expected
func1 a = 1; // #error: The name of a type
fn void func1() {}