Skip to content

Commit

Permalink
fix: type upgrade for the assign stmt type annotation for the call ex…
Browse files Browse the repository at this point in the history
…pression

Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Oct 10, 2024
1 parent 3e84ea4 commit 29694c6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kclvm/sema/src/resolver/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,12 @@ impl<'ctx> Resolver<'ctx> {
self.clear_config_expr_context(init_stack_depth as usize, false);
value_ty
}
_ => self.expr(expr),
_ => {
self.ctx.config_expr_context.push(None);
let value_ty = self.expr(expr);
self.ctx.config_expr_context.pop();
value_ty
}
};
self.must_assignable_to(
value_ty.clone(),
Expand Down
11 changes: 11 additions & 0 deletions test/grammar/types/args/lambda_types_03/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
schema Cluster:
name: str
extra: int

a: Cluster = { name = "abc", extra = 6 }

enrich = lambda value {
[a]
}

result_typesafe: [Cluster] = enrich({name = "abc", extra = 6 })
6 changes: 6 additions & 0 deletions test/grammar/types/args/lambda_types_03/stdout.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
a:
name: abc
extra: 6
result_typesafe:
- name: abc
extra: 6

0 comments on commit 29694c6

Please sign in to comment.