diff --git a/main.cpp b/main.cpp index ff90deb..26a7717 100644 --- a/main.cpp +++ b/main.cpp @@ -203,10 +203,10 @@ int main(int argument_count, char **arguments){ #endif Scratch scratch; Array files = {scratch}; - // files.add("lambdas.kl"_s); - // files.add("order1.kl"_s); - // files.add("order2.kl"_s); - // files.add("new_types.kl"_s); + files.add("lambdas.kl"_s); + files.add("order1.kl"_s); + files.add("order2.kl"_s); + files.add("new_types.kl"_s); files.add("enums.kl"_s); // files.add("G.globals.kl"_s); // files.add("euler.kl"_s); diff --git a/typechecking.cpp b/typechecking.cpp index ff4e639..090e1cc 100644 --- a/typechecking.cpp +++ b/typechecking.cpp @@ -670,7 +670,7 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_context){ node->resolved_decl = resolve_name(node->parent_scope, node->pos, node->intern_val); Operand result = operand(node->resolved_decl); - if(node->resolved_decl->kind == AST_CONST){ + if(result.is_const){ rewrite_into_const(node, Ast_Atom, node->resolved_decl->value); } return result; diff --git a/typechecking.h b/typechecking.h index 7201290..308c436 100644 --- a/typechecking.h +++ b/typechecking.h @@ -30,6 +30,9 @@ operand(Ast_Decl *decl){ result.is_const = decl->kind != AST_VAR ? true : false; result.is_lvalue= decl->kind == AST_CONST ? false : true; // Cant assign to const values result.value = decl->value; + if(decl->kind == AST_LAMBDA){ + result.is_const = false; + } else assert(!is_lambda(decl->type)); return result; }