mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
test for separate scopes not colliding
This commit is contained in:
parent
09a78d6235
commit
137fe99258
1 changed files with 22 additions and 0 deletions
|
|
@ -287,6 +287,28 @@ export fn _start() -> unreachable {
|
||||||
if (!true) { puts("BAD 2"); }
|
if (!true) { puts("BAD 2"); }
|
||||||
if (!false) { puts("OK 2"); }
|
if (!false) { puts("OK 2"); }
|
||||||
exit(0);
|
exit(0);
|
||||||
|
}
|
||||||
|
)SOURCE", "OK 1\nOK 2\n");
|
||||||
|
|
||||||
|
add_simple_case("separate block scopes", R"SOURCE(
|
||||||
|
#link("c")
|
||||||
|
extern {
|
||||||
|
fn puts(s: *const u8) -> i32;
|
||||||
|
fn exit(code: i32) -> unreachable;
|
||||||
|
}
|
||||||
|
|
||||||
|
export fn _start() -> unreachable {
|
||||||
|
if (true) {
|
||||||
|
let no_conflict = 5;
|
||||||
|
if (no_conflict == 5) { puts("OK 1"); }
|
||||||
|
}
|
||||||
|
|
||||||
|
let c = {
|
||||||
|
let no_conflict = 10;
|
||||||
|
no_conflict
|
||||||
|
};
|
||||||
|
if (c == 10) { puts("OK 2"); }
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
)SOURCE", "OK 1\nOK 2\n");
|
)SOURCE", "OK 1\nOK 2\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue