diff --git a/src/compiler.rs b/src/compiler.rs index 82a2c3c..87aed25 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -464,9 +464,44 @@ fn compile_expr( compile_expr(builder, block_result, variables, current_var, func_ids, module) } - _ => Err(CompileError { - message: "Unsupported expression type".to_string(), - }), + expr => { + let expr_type = match expr { + Expr::Literal(lit) => match lit { + Literal::String(_) => "String literal", + Literal::Float(_) => "Float literal", + Literal::Char(_) => "Char literal", + Literal::Unit => "Unit literal", + _ => "Literal", + }, + Expr::EffectOp { effect, operation, .. } => { + return Err(CompileError { + message: format!("Effect operation '{}.{}' - effects are not supported in JIT", + effect.name, operation.name), + }); + } + Expr::Field { .. } => "Field access (records)", + Expr::Lambda { .. } => "Lambda/closure", + Expr::Match { .. } => "Match expression", + Expr::List { .. } => "List literal", + Expr::Record { .. } => "Record literal", + Expr::Tuple { .. } => "Tuple literal", + Expr::Index { .. } => "Index access", + Expr::Run { .. } => "Run expression (effects)", + Expr::Handle { .. } => "Handle expression (effects)", + Expr::Resume { .. } => "Resume expression (effects)", + Expr::Pipe { .. } => "Pipe operator", + Expr::Interpolation { .. } => "String interpolation", + Expr::Constructor { name, .. } => { + return Err(CompileError { + message: format!("ADT constructor '{}' - algebraic data types are not supported in JIT", name.name), + }); + } + _ => "Unknown expression", + }; + Err(CompileError { + message: format!("Unsupported in JIT: {}", expr_type), + }) + } } }