diff --git a/schala-lang/language/src/reduced_ir/mod.rs b/schala-lang/language/src/reduced_ir/mod.rs index f6f43a2..67bd8ad 100644 --- a/schala-lang/language/src/reduced_ir/mod.rs +++ b/schala-lang/language/src/reduced_ir/mod.rs @@ -225,7 +225,7 @@ impl<'a> Reducer<'a> { GlobalBinding => Expression::Lookup(Lookup::GlobalVar(def_id.unwrap())), LocalVariable => Expression::Lookup(Lookup::LocalVar(def_id.unwrap())), FunctionParam(n) => Expression::Lookup(Lookup::Param(n)), - DataConstructor { .. } => { + DataConstructor { index, arity, type_id } => { Expression::ReductionError("DataConstructor not supported".to_string()) }, RecordConstructor { .. } => { diff --git a/schala-lang/language/src/tree_walk_eval/test.rs b/schala-lang/language/src/tree_walk_eval/test.rs index aef4ca5..828b491 100644 --- a/schala-lang/language/src/tree_walk_eval/test.rs +++ b/schala-lang/language/src/tree_walk_eval/test.rs @@ -5,6 +5,7 @@ use crate::tree_walk_eval::State; fn evaluate_input(input: &str) -> Result { let ast = crate::util::quick_ast(input); + println!("AST: {:?}", ast); let mut symbol_table = SymbolTable::new(); symbol_table.process_ast(&ast).unwrap(); let reduced_ir = crate::reduced_ir::reduce(&ast, &symbol_table); @@ -62,6 +63,18 @@ fn scopes() { eval_assert(scope_ok, "20"); } +#[test] +fn adt_output_1() { + let source = r#" + +type Option = Some(T) | None +let x = Option::Some(10) +x +"#; + eval_assert(source, "Option::Some(10)"); +} + +/* #[test] fn if_is_patterns() { let source = r#" @@ -75,7 +88,7 @@ type Option = Some(T) | None let x = Option::None; if x is Option::Some(q) then { q } else { 0 }"#; eval_assert(source, "0"); } - +*/ #[test]