diff --git a/kclvm/sema/src/advanced_resolver/node.rs b/kclvm/sema/src/advanced_resolver/node.rs index d52855d62..a5e910fc8 100644 --- a/kclvm/sema/src/advanced_resolver/node.rs +++ b/kclvm/sema/src/advanced_resolver/node.rs @@ -97,9 +97,6 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for AdvancedResolver<'ctx> { } self.walk_type_expr(assign_stmt.ty.as_ref().map(|ty| ty.as_ref()))?; self.expr(&assign_stmt.value)?; - if !assign_stmt.targets.is_empty() { - self.ctx.schema_symbol_stack.pop(); - }; Ok(None) } diff --git a/kclvm/sema/src/resolver/node.rs b/kclvm/sema/src/resolver/node.rs index 0d58ca41c..3296f9115 100644 --- a/kclvm/sema/src/resolver/node.rs +++ b/kclvm/sema/src/resolver/node.rs @@ -1270,12 +1270,14 @@ impl<'ctx> Resolver<'ctx> { self.ctx.start_pos = start; self.ctx.end_pos = end; } - let ty = self.walk_expr(&expr.node); let expected_ty = match self.ctx.config_expr_context.last() { Some(ty) => ty.clone().map(|o| o.ty), None => None, }; + + let ty = self.walk_expr(&expr.node); + if let Some(expected_ty) = expected_ty { let upgrade_ty = self.upgrade_dict_to_schema(ty.clone(), expected_ty, &expr.get_span_pos());