Skip to content

Commit 994a46b

Browse files
committed
refactor: update test.hlx to meet the new standard
1 parent 0a3008f commit 994a46b

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

test.hlx

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,56 @@
11
import std::Error::ValueError as ValueError;
22

3+
ffi "c++" import "source_location";
4+
35
interface BasicI {
46
fn op==(self, other: i32) -> bool;
57
}
68

9+
/* we need to add the following to every function def const loc: libcxx::source_location = libcxx::source_location::current() along with */
10+
fn other_foo() -> i32 {
11+
panic std::Error::NullValueError("This is a value error");
12+
return 42;
13+
}
14+
715
struct Basic {
816
var count: i32 = 109;
917

1018
fn op == (self, other: i32) -> bool {
19+
20+
var val = other_foo();
21+
std::print(f"Value: {val}");
22+
1123
return self.count == other;
1224
}
1325
}
1426

1527

16-
fn <T> new_function() -> T? requires T impl BasicI {
17-
panic ValueError::ValueError("This is a test error message");
28+
fn <T impl BasicI, U impl BasicI> new_function() -> T? {
29+
30+
panic ValueError::ValueError("This is a value error");
31+
1832
return T();
1933
}
2034

2135

36+
class Foo {
37+
fn something() -> i32 {
38+
return 42;
39+
}
40+
41+
}
42+
2243

2344
fn main() -> i32 {
24-
var call = new_function::<Basic>();
45+
var call = new_function::<Basic, Basic>();
2546

2647
std::print(f"Count: {(*call).count}");
2748

28-
49+
var obj = Foo();
50+
obj.something();
51+
52+
var eq = (*call) == 109;
53+
std::print(f"Equal: {eq}");
2954

3055
return 0;
3156
}

0 commit comments

Comments
 (0)