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:
parent
a3e9a36553
commit
d2b33397cc
@ -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 {
|
||||||
|
@ -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!')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user