Skip to content

Commit 010f428

Browse files
5c077m4nlpil
authored andcommitted
Detect if missing variable is a type or not
1 parent 7ab17ec commit 010f428

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler-core/src/error.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -2259,7 +2259,13 @@ but no type in scope with that name."
22592259
let text = if *type_with_name_in_scope {
22602260
wrap_format!("`{name}` is a type, it cannot be used as a value.")
22612261
} else {
2262-
wrap_format!("The name `{name}` is not in scope here.")
2262+
let is_first_char_uppercase = name.chars().next().is_some_and(char::is_uppercase);
2263+
2264+
if is_first_char_uppercase {
2265+
wrap_format!("The custom type variant constructor `{name}` is not in scope here.")
2266+
} else {
2267+
wrap_format!("The name `{name}` is not in scope here.")
2268+
}
22632269
};
22642270
Diagnostic {
22652271
title: "Unknown variable".into(),

0 commit comments

Comments
 (0)