Skip to content

Commit

Permalink
Tuples are working
Browse files Browse the repository at this point in the history
  • Loading branch information
JCBurnside committed Mar 19, 2024
1 parent 2a4d74e commit fb69e3b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cli/test.fb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ let show_something_else _ : () -> bool =
print_str "general kenobi\n";
return false;

let test (a:(int32,int32)) =
let x : int32 = 0;
return x;

let main _ : () -> () =
let a : bool = true;
let x : int32 = 0;
Expand Down
3 changes: 2 additions & 1 deletion compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ pub fn from_file<'ctx>(
);
let ast = inference_context.inference(ast);
let mut ast = TypedModuleDeclaration::from(ast, &fwd_declarations, &HashMap::new()); //TODO: foward declare std lib

#[cfg(debug_assertions)]
println!("{:?}", ast.declarations);
ast.lower_generics(&HashMap::new());
(
if errors.is_empty() {
Expand Down
3 changes: 2 additions & 1 deletion llvm-codegen/src/code_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ impl<'ctx> CodeGen<'ctx> {
self.builder.build_unconditional_branch(ret_bb).unwrap();
} else {
let value = self.compile_expr(expr);
let value: BasicValueEnum<'ctx> = value.try_into().unwrap();

let value = self.value_or_load(value.try_into().unwrap());
if let Some(ret_target) = self.ret_target.as_ref() {
self.builder.build_store(*ret_target, value).unwrap();
}
Expand Down

0 comments on commit fb69e3b

Please sign in to comment.