Do not add function decls to the namespace if they fail to type-check.
@@ -197,11 +197,14 @@ impl<'sc> TypedAstNode<'sc> {
warnings,
errors
);
-
+ if errors.is_empty() {
+ // Add this function declaration to the namespace only if it
+ // fully typechecked without errors.
namespace.insert(
decl.name.clone(),
TypedDeclaration::FunctionDeclaration(decl.clone()),
);
+ }
TypedDeclaration::FunctionDeclaration(decl)
}
Declaration::TraitDeclaration(TraitDeclaration {
