Sema: add source location to coerce result ptr, fix negation error

This commit is contained in:
Veikka Tuominen
2022-06-28 20:50:14 +03:00
committed by Jakub Konka
parent 979910dc38
commit cc3336c784
9 changed files with 62 additions and 34 deletions

View File

@@ -0,0 +1,12 @@
export fn entry() void {
var a = &b;
_ = a;
}
fn b() callconv(.Inline) void { }
// error
// backend=stage2
// target=native
//
// :2:9: error: variable of type '*const fn() callconv(.Inline) void' must be const or comptime
// :2:9: note: function has inline calling convention

View File

@@ -8,7 +8,7 @@ export fn entry() void {
}
// error
// backend=stage1
// backend=stage2
// target=native
//
// tmp.zig:6:15: error: negation of type 'anyerror!u32'
// :6:15: error: negation of type 'anyerror!u32'

View File

@@ -6,8 +6,7 @@ export fn entry() void {
}
// error
// backend=stage1
// backend=stage2
// target=native
// is_test=1
//
// tmp.zig:2:15: error: cannot assign to constant
// :2:15: error: cannot assign to constant

View File

@@ -9,8 +9,7 @@ export fn entry() void {
}
// error
// backend=stage1
// backend=stage2
// target=native
// is_test=1
//
// tmp.zig:5:10: error: cannot assign to constant
// :5:10: error: cannot assign to constant

View File

@@ -1,12 +0,0 @@
export fn entry() void {
var a = b;
_ = a;
}
fn b() callconv(.Inline) void { }
// error
// backend=stage1
// target=native
//
// tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var
// tmp.zig:5:1: note: declared here