Skip to content

Commit

Permalink
Revert "fix: index signature value symbol (kcl-lang#1647)"
Browse files Browse the repository at this point in the history
This reverts commit 913e79e.
  • Loading branch information
Peefy committed Sep 14, 2024
1 parent 6103ab7 commit 58f0d9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
9 changes: 5 additions & 4 deletions kclvm/sema/src/advanced_resolver/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,12 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for AdvancedResolver<'ctx> {
self.gs
.get_scopes_mut()
.add_def_to_scope(cur_scope, key_name.node.clone(), value);

self.walk_type_expr(Some(&index_signature.node.value_ty))?;
if let Some(value) = &index_signature.node.value {
self.expr(value)?;
};
}
self.walk_type_expr(Some(&index_signature.node.value_ty))?;
if let Some(value) = &index_signature.node.value {
self.expr(value)?;
};
last_end_pos = index_signature.get_end_pos();
}

Expand Down
16 changes: 1 addition & 15 deletions kclvm/sema/src/resolver/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,7 @@ impl<'ctx> Resolver<'ctx> {
// Check index signature default value type.
if let Some(value) = &index_signature_node.node.value {
let expected_ty = index_signature.val_ty;
let value_ty = if let TypeKind::Schema(ty) = &expected_ty.kind {
let (start, end) = value.get_span_pos();
let obj = self.new_config_expr_context_item(
&ty.name,
expected_ty.clone(),
start,
end,
);
let init_stack_depth = self.switch_config_expr_context(Some(obj));
let value_ty = self.expr(value);
self.clear_config_expr_context(init_stack_depth as usize, false);
value_ty
} else {
self.expr(value)
};
let value_ty = self.expr(value);
self.must_assignable_to(
value_ty,
expected_ty,
Expand Down

0 comments on commit 58f0d9e

Please sign in to comment.