better `foo must return (int, int)` error

pull/2997/head
Alexander Medvednikov 2019-12-05 18:55:27 +03:00
parent cb46bf314e
commit cca650c655
1 changed files with 14 additions and 9 deletions

View File

@ -171,12 +171,17 @@ fn (p mut Parser) print_error_context(){
// p.scanner.debug_tokens() // p.scanner.debug_tokens()
} }
fn normalized_error( s string ) string { fn normalized_error(s string) string {
// Print `[]int` instead of `array_int` in errors // Print `[]int` instead of `array_int` in errors
return s.replace('array_', '[]') mut res := s.replace('array_', '[]')
.replace('__', '.') .replace('__', '.')
.replace('Option_', '?') .replace('Option_', '?')
.replace('main.', '') .replace('main.', '')
if res.contains('_V_MulRet_') {
res = res.replace('_V_MulRet_', '(').replace('_V_', ', ')
res = res[..res.len-1] + ')"'
}
return res
} }
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////