@@ -1363,6 +1363,10 @@ impl SsaBuilder {
13631363 // Evaluate expression for side effects
13641364 self . translate_expression ( block_id, expr) ?;
13651365 }
1366+ TypedStatement :: Yield ( expr) => {
1367+ // Yield behaves like an expression statement at the SSA level.
1368+ self . translate_expression ( block_id, expr) ?;
1369+ }
13661370
13671371 TypedStatement :: Match ( match_stmt) => {
13681372 // Handle match statement: evaluate scrutinee
@@ -1655,6 +1659,14 @@ impl SsaBuilder {
16551659 }
16561660 eprintln ! ( "[DEBUG SSA] No trait dispatch, using native binary op" ) ;
16571661
1662+ // `@` must dispatch through MatMul::matmul; do not silently alias to numeric `mul`.
1663+ if matches ! ( op, FrontendOp :: MatMul ) {
1664+ return Err ( crate :: CompilerError :: Analysis ( format ! (
1665+ "matrix multiplication '@' requires MatMul::matmul implementation for lhs type {:?}" ,
1666+ left_with_type. ty
1667+ ) ) ) ;
1668+ }
1669+
16581670 // Regular binary operations for primitive types
16591671 let left_val = self . translate_expression ( block_id, left) ?;
16601672 let right_val = self . translate_expression ( block_id, right) ?;
@@ -1836,6 +1848,28 @@ impl SsaBuilder {
18361848 Ok ( result_or_void)
18371849 }
18381850
1851+ TypedExpression :: Compute ( compute) => {
1852+ // Lower compute expressions through the existing call pipeline for now.
1853+ // This preserves call-based execution while keeping typed compute structure.
1854+ let compute_name = InternedString :: new_global ( "compute" ) ;
1855+ let lowered = zyntax_typed_ast:: typed_ast:: TypedCall {
1856+ callee : Box :: new ( zyntax_typed_ast:: typed_node (
1857+ TypedExpression :: Variable ( compute_name) ,
1858+ Type :: Any ,
1859+ expr. span ,
1860+ ) ) ,
1861+ positional_args : compute. args . clone ( ) ,
1862+ named_args : vec ! [ ] ,
1863+ type_args : vec ! [ ] ,
1864+ } ;
1865+ let lowered_expr = zyntax_typed_ast:: typed_node (
1866+ TypedExpression :: Call ( lowered) ,
1867+ expr. ty . clone ( ) ,
1868+ expr. span ,
1869+ ) ;
1870+ self . translate_expression ( block_id, & lowered_expr)
1871+ }
1872+
18391873 TypedExpression :: Field ( field_access) => {
18401874 let object = & field_access. object ;
18411875 let field = & field_access. field ;
@@ -4097,6 +4131,7 @@ impl SsaBuilder {
40974131 FrontendOp :: Add => HirOp :: Add ,
40984132 FrontendOp :: Sub => HirOp :: Sub ,
40994133 FrontendOp :: Mul => HirOp :: Mul ,
4134+ FrontendOp :: MatMul => HirOp :: Mul ,
41004135 FrontendOp :: Div => HirOp :: Div ,
41014136 FrontendOp :: Rem => HirOp :: Rem ,
41024137 FrontendOp :: BitAnd => HirOp :: And ,
@@ -4150,6 +4185,7 @@ impl SsaBuilder {
41504185 FrontendOp :: Add => "add" ,
41514186 FrontendOp :: Sub => "sub" ,
41524187 FrontendOp :: Mul => "mul" ,
4188+ FrontendOp :: MatMul => "matmul" ,
41534189 FrontendOp :: Div => "div" ,
41544190 FrontendOp :: Rem => "mod" ,
41554191 FrontendOp :: Eq => "eq" ,
@@ -6206,6 +6242,12 @@ impl SsaBuilder {
62066242 result_ty,
62076243 ) ?;
62086244
6245+ if matches ! ( bin. op, zyntax_typed_ast:: typed_ast:: BinaryOp :: MatMul ) {
6246+ return Err ( crate :: CompilerError :: Analysis (
6247+ "matrix multiplication '@' requires trait dispatch and is not supported in lambda const lowering" . to_string ( ) ,
6248+ ) ) ;
6249+ }
6250+
62096251 let hir_op = self . convert_binary_op ( & bin. op ) ;
62106252 let result_id = HirId :: new ( ) ;
62116253 func. values . insert (
0 commit comments