From 7b2661f8b5f32e8467faf13af326dacbcc9a233c Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Wed, 5 Jul 2023 23:23:03 -0500 Subject: [PATCH] added: old test case --- tests/ignored_return_values | 5 +++++ tests/ignored_return_values.onyx | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/ignored_return_values create mode 100644 tests/ignored_return_values.onyx diff --git a/tests/ignored_return_values b/tests/ignored_return_values new file mode 100644 index 00000000..20cae175 --- /dev/null +++ b/tests/ignored_return_values @@ -0,0 +1,5 @@ +hello +123 +Str: hello +12 +13 diff --git a/tests/ignored_return_values.onyx b/tests/ignored_return_values.onyx new file mode 100644 index 00000000..d27f529a --- /dev/null +++ b/tests/ignored_return_values.onyx @@ -0,0 +1,35 @@ +use core + +foo :: () -> (str, i32, bool, Allocator) { + return "hello", 123, false, .{}; +} + +takes_str :: (s: str) { + core.printf("Str: {}\n", s); +} + +Foo :: struct { + x, y: i32; + m: str; +} + +#inject Foo { + method :: (f: ^Foo) -> (i32, i32, str) { + return f.x, f.y, f.m; + } +} + +main :: () { + m, n := foo(); + core.println(m); + core.println(n); + + takes_str(foo()); + + f := Foo.{ 12, 34, "Working!" }; + x := f->method(); + core.println(x); + + y := 1; + core.println(y + Foo.method(^f)); +} -- 2.25.1