Before:
assign_local_bad_coercion.zig:5:1: error: expected type 'u32', found 'u64'
export fn constEntry() u32 {
^~~~~~
assign_local_bad_coercion.zig:11:19: error: expected type 'u32', found 'u64'
var x: u32 = g();
~^~
After:
assign_local_bad_coercion.zig:6:21: error: expected type 'u32', found 'u64'
const x: u32 = g();
~^~
assign_local_bad_coercion.zig:11:19: error: expected type 'u32', found 'u64'
var x: u32 = g();
~^~
33 lines
640 B
Zig
33 lines
640 B
Zig
export fn f1() void {
|
|
const x: usize = for ("hello") |_| {};
|
|
_ = x;
|
|
}
|
|
export fn f2() void {
|
|
const x: usize = for ("hello") |_| {
|
|
break;
|
|
};
|
|
_ = x;
|
|
}
|
|
export fn f3() void {
|
|
var t: bool = true;
|
|
const x: usize = while (t) {
|
|
break;
|
|
};
|
|
_ = x;
|
|
}
|
|
export fn f4() void {
|
|
const x: usize = blk: {
|
|
break :blk;
|
|
};
|
|
_ = x;
|
|
}
|
|
|
|
// error
|
|
// backend=stage2
|
|
// target=native
|
|
//
|
|
// :2:22: error: expected type 'usize', found 'void'
|
|
// :7:9: error: expected type 'usize', found 'void'
|
|
// :14:9: error: expected type 'usize', found 'void'
|
|
// :19:27: error: expected type 'usize', found 'void'
|