diff --git a/src/codegen.rs b/src/codegen.rs index 3396d17..dd69279 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -75,7 +75,7 @@ impl Default for RustCodegen { impl GetRust for TypeExpr { fn get_rust(&self) -> String { match self { - TypeExpr::Path(path) => path.get_rust(), + TypeExpr::Path(path) => get_static_type_path(path), } } } @@ -314,3 +314,13 @@ impl GetRust for StaticPath { self.0.join("::") } } + +pub fn get_static_type_path(path: &StaticPath) -> String { + let rust_path = path.get_rust(); + + if rust_path == "void" { + format!("()") + } else { + rust_path + } +} diff --git a/test/src/main.mist b/test/src/main.mist index 3ed2575..af940c0 100644 --- a/test/src/main.mist +++ b/test/src/main.mist @@ -1,3 +1,3 @@ -i32 test() { - std::fs::write(); -} +void main() { + +} \ No newline at end of file