Fixed returning

This commit is contained in:
2026-06-09 18:05:47 +02:00
parent ba5145d9ad
commit 9949027bc9
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -614,7 +614,7 @@ pub fn gen_method_point(method: &FunctionDecl, ctx: &mut Context, cg: &mut RustC
param.name.gen_rust(ctx, cg);
}
cg.addln(");");
cg.addln(")");
cg.indent -= 1;
cg.add_indentedln("}");
+10
View File
@@ -23,6 +23,10 @@ pub class Mammal<T> : Animal<T> {
}
pub fn args_test(*self, x i32, y *str) {}
pub fn returning<'a>(*self) *'a str {
"Mammal"
}
}
pub class Dog : Mammal<i32> {
@@ -35,6 +39,10 @@ pub class Dog : Mammal<i32> {
pub override(Animal<i32>) fn speak(*self) {
println!("Woof!");
}
pub override fn returning(*self) *str {
"Dog"
}
}
pub fn run_tests() {
@@ -43,4 +51,6 @@ pub fn run_tests() {
dawg.args_test(10, "hello");
dawg.test_speak();
println!("{}", dawg.returning());
}