Files
zig/test/self_hosted.zig
Andrew Kelley 1f9734d1ee allow defining errors with the same name
they get the same value, too.
2016-02-04 00:58:45 -07:00

49 lines
719 B
Zig

#attribute("test")
fn empty_function() {}
/**
* multi line doc comment
*/
/// this is a documentation comment
/// doc comment line 2
#attribute("test")
fn comments() {
comments_f1(/* mid-line comment /* nested */ */ "OK\n");
}
fn comments_f1(s: []u8) {}
#attribute("test")
fn fn_call_of_struct_field() {
if (call_struct_field(Foo {.ptr = a_func,}) != 13) {
unreachable{};
}
}
struct Foo {
ptr: fn() -> i32,
}
fn a_func() -> i32 { 13 }
fn call_struct_field(foo: Foo) -> i32 {
return foo.ptr();
}
error AnError;
error AnError;
error SecondError;
#attribute("test")
fn redefinition_of_error_values_allowed() {
if (error.AnError == error.SecondError) unreachable{}
}