diff --git a/lang/src/son.rs b/lang/src/son.rs index a55328d32..a52d3802e 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -19,7 +19,6 @@ use { }, alloc::{string::String, vec::Vec}, core::{ - any::Any, assert_matches::debug_assert_matches, cell::{Cell, RefCell}, fmt::{self, Debug, Display, Write}, @@ -1878,7 +1877,21 @@ impl Nodes { false } Kind::Join => false, - Kind::Stre => self[user].inputs[3] != val, + Kind::Stre => { + debug_assert_eq!( + self[user].inputs[4..] + .iter() + .filter(|&&v| self[v].kind != Kind::Load) + .copied() + .collect::>(), + vec![] + ); + debug_assert_matches!( + self[self[user].inputs[3]].kind, + Kind::Stre | Kind::Mem | Kind::Phi + ); + self[user].inputs.iter().position(|&v| v == val).is_some_and(|v| v < 3) + } Kind::Load => self[user].inputs[2] != val, _ => self[user].inputs[0] != val || self[user].inputs[1..].contains(&val), } @@ -4422,8 +4435,8 @@ impl<'a> Codegen<'a> { fn compute_signature(&mut self, func: &mut ty::Func, pos: Pos, args: &[Expr]) -> Option { let Func { file, expr, sig, .. } = self.tys.ins.funcs[*func]; - let fast = self.files[file.index()].clone(); - let &Expr::Closure { args: cargs, ret, .. } = expr.get(&fast) else { + let fast = &self.files[file.index()]; + let &Expr::Closure { args: cargs, ret, .. } = expr.get(fast) else { unreachable!(); };