1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

optionals: better errors

This commit is contained in:
Alexander Medvednikov 2019-07-24 22:41:46 +02:00
parent a3e9a36553
commit d2b33397cc
2 changed files with 2 additions and 1 deletions

View File

@ -761,7 +761,7 @@ fn (p mut Parser) error(s string) {
} }
// p.scanner.debug_tokens() // p.scanner.debug_tokens()
// Print `[]int` instead of `array_int` in errors // Print `[]int` instead of `array_int` in errors
p.scanner.error(s.replace('array_', '[]').replace('__', '.')) p.scanner.error(s.replace('array_', '[]').replace('__', '.').replace('Option_', '?'))
} }
fn (p &Parser) first_run() bool { fn (p &Parser) first_run() bool {

View File

@ -10,6 +10,7 @@ fn test_err(){
} }
fn err_call(ok bool) ?int { fn err_call(ok bool) ?int {
return 'sdf'
if !ok { if !ok {
return error('Not ok!') return error('Not ok!')
} }