Sema: add note suggesting dropping try on non error-unions

This commit is contained in:
mikastiv
2024-11-03 22:48:41 -05:00
committed by Matthew Lugg
parent 19fc5f4fb2
commit 1a15fbe960
3 changed files with 25 additions and 6 deletions

View File

@@ -13,4 +13,5 @@ pub fn bar() u8 {
// error
//
// :6:12: error: expected error union type, found 'u8'
// :6:12: note: consider omitting 'try'
// :2:8: note: called at comptime here

View File

@@ -43,10 +43,16 @@ comptime {
// error
//
// :5:23: error: expected error union type, found 'comptime_int'
// :5:23: note: consider omitting 'try'
// :10:23: error: expected error union type, found '@TypeOf(.{})'
// :10:23: note: consider omitting 'try'
// :15:23: error: expected error union type, found 'tmp.S'
// :1:11: note: struct declared here
// :15:23: note: consider omitting 'try'
// :20:27: error: expected error union type, found 'tmp.S'
// :1:11: note: struct declared here
// :20:27: note: consider omitting 'try'
// :25:23: error: expected error union type, found 'struct { comptime *const [5:0]u8 = "hello" }'
// :25:23: note: consider omitting 'try'
// :31:13: error: expected error union type, found 'u32'
// :31:13: note: consider omitting 'try'