Ayyyyyy basic sum types work now
3 files changed, 20 insertions(+), 7 deletions(-)

M src/backend/rust.rs
M src/passes.rs
M tests/programs/test_sum1.gt
M src/backend/rust.rs +3 -2
@@ 226,7 226,7 @@ fn compile_decl(w: &mut impl Write, decl
                     let args = param_strings.join(", ");
                     writeln!(w, "pub enum {}<{}> {{ ", nstr, args)?;
                     for (nm, ty) in body {
-                        writeln!(w, "    {}({}),", nm, compile_typename(ty))?;
+                        writeln!(w, "    {} ({}),", nm, compile_typename(ty))?;
                     }
                     writeln!(w, "}}")?;
                     Ok(())

          
@@ 494,8 494,9 @@ fn compile_expr(expr: &hir::ExprNode, tc
             body,
         } => {
             // This should just be a function call, right?
+            // hahahahha NO this is what has to exist INSIDE the function call.
             format!(
-                "{}.{}( {} )",
+                "{}::{}({})",
                 &*name.val(),
                 &*variant.val(),
                 compile_expr(body, tck)

          
M src/passes.rs +14 -0
@@ 35,6 35,8 @@ pub fn run_typechecked_passes(ir: Ir, tc
     let res = passes.iter().fold(ir, |prev_ir, f| f(prev_ir, tck));
     println!();
     println!("{}", res);
+    // let passes: &[Pass] = &[lambda_lift];
+    // passes.iter().fold(res, |prev_ir, f| f(prev_ir))
     res
 }
 

          
@@ 459,6 461,18 @@ fn lambda_lift(ir: Ir) -> Ir {
                     body: new_body,
                 }
             }
+            D::Const {
+                name,
+                typename,
+                init,
+            } => {
+                let new_body = expr_map(init, &mut |e| lambda_lift_expr(e, &mut new_functions));
+                D::Const {
+                    name,
+                    typename,
+                    init: new_body,
+                }
+            }
             x => x,
         })
         .collect();

          
M tests/programs/test_sum1.gt +3 -5
@@ 13,17 13,15 @@ type Foo = sum
     end,
 end
 
-/-
 fn thing(i Foo) Foo =
     i
 end
--/
 
 
 fn main() {} =
     let x Foo = Foo.X {}
-    --let y Foo = Foo.Y { 12, true, false }
-    --let z Foo = Foo.Z { .a = 12, .b = 40 }
-    --let a = thing(y)
+    let y Foo = Foo.Y { 12, true, false }
+    let z Foo = Foo.Z { .a = 12, .b = 40 }
+    let a = thing(y)
 end