diff --git a/compiler/noirc_frontend/src/hir/type_check/expr.rs b/compiler/noirc_frontend/src/hir/type_check/expr.rs index 29e5f6f63e8..72e28fdbdaf 100644 --- a/compiler/noirc_frontend/src/hir/type_check/expr.rs +++ b/compiler/noirc_frontend/src/hir/type_check/expr.rs @@ -154,6 +154,8 @@ impl<'interner> TypeChecker<'interner> { // Need to setup these flags here as `self` is borrowed mutably to type check the rest of the call expression // These flags are later used to type check calls to unconstrained functions from constrained functions let Some(current_func) = self.current_function else { + // If we don't have a value for `current_function` then we are initializing a global. + // We disallow these from being assigned from a function call. self.errors.push(TypeCheckError::GlobalFunctionCall { span: self.interner.expr_span(expr_id), });