Skip to content

Commit 18a1fca

Browse files
committed
Add class method returning match statement test case
1 parent 3786fb6 commit 18a1fca

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/code/class.kyo

+24
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,27 @@ fn main() i32 {
244244
var x: X = X(5);
245245
return x.add(2);
246246
}
247+
248+
// NAME MethodWithReturnMatch
249+
// ERR 0
250+
// RET 13
251+
252+
cdecl fn printf(fmt: char*, ...) i32;
253+
254+
class Fibonacci {
255+
constructor(self: Fibonacci*) {
256+
}
257+
258+
fn get(self: Fibonacci*, n: i32) i32 {
259+
return match n {
260+
0 => 0,
261+
1 => 1,
262+
default => self.get(n - 1) + self.get(n - 2),
263+
};
264+
}
265+
}
266+
267+
fn main() i32 {
268+
var fib: Fibonacci = Fibonacci();
269+
return fib.get(7);
270+
}

0 commit comments

Comments
 (0)