From 948710dc2797981670a58c529773332d2e71035e Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Mon, 28 Oct 2024 12:36:46 +0100 Subject: [PATCH] fixing an infeence bug --- lang/src/son.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lang/src/son.rs b/lang/src/son.rs index e966a489..715e6298 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -1211,7 +1211,7 @@ impl Nodes { && let Some(&n) = full_stores.next() && full_stores.next().is_none() => { - if full_read_into.replace(n).is_some() { + if full_read_into.replace((n, self[o].inputs[2])).is_some() { continue 'o; } } @@ -1219,7 +1219,7 @@ impl Nodes { } } - let Some(dst) = full_read_into else { continue }; + let Some((dst, o)) = full_read_into else { continue }; let mut saved = Vc::default(); let mut cursor = dst; @@ -2797,6 +2797,7 @@ impl<'a> Codegen<'a> { Some(self.ci.nodes.new_node_lit(ty::Id::TYPE, Kind::CInt { value }, [VOID])) } Expr::Ctor { pos, ty, fields, .. } => { + ctx.ty = ty.map(|ty| self.ty(ty)).or(ctx.ty); inference!(sty, ctx, self, pos, "struct", ".{...}"); let ty::Kind::Struct(s) = sty.expand() else {