Add support for global variables without type annotation #548

Merged
sb10q merged 4 commits from enhance/global-var into master 2024-10-08 09:05:38 +08:00
1 changed files with 1 additions and 1 deletions
Showing only changes of commit 9c6685fa8f - Show all commits

View File

@ -36,7 +36,7 @@ impl<'a> Inferencer<'a> {
ExprKind::Name { id, .. } => { ExprKind::Name { id, .. } => {
// If `id` refers to a declared symbol, reject this assignment if it is used in the // If `id` refers to a declared symbol, reject this assignment if it is used in the
// context of an (implicit) global variable // context of an (implicit) global variable
if let Some(id_info) = self.defined_identifiers.get(id) { if let Some(id_info) = defined_identifiers.get(id) {
if matches!( if matches!(
id_info.source, id_info.source,
DeclarationSource::Global { is_explicit: Some(false) } DeclarationSource::Global { is_explicit: Some(false) }