mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parent
60e817ff32
commit
d7b1e57186
@ -556,7 +556,9 @@ pub fn (mut b Builder) print_warnings_and_errors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if redefines.len > 0 {
|
if redefines.len > 0 {
|
||||||
eprintln('redefinition of function `$fn_name`')
|
ferror := util.formatted_error('builder error:', 'redefinition of function `$fn_name`',
|
||||||
|
'', token.Pos{})
|
||||||
|
eprintln(ferror)
|
||||||
for redefine in redefines {
|
for redefine in redefines {
|
||||||
eprintln(util.formatted_error('conflicting declaration:', redefine.fheader,
|
eprintln(util.formatted_error('conflicting declaration:', redefine.fheader,
|
||||||
redefine.fpath, redefine.f.pos))
|
redefine.fpath, redefine.f.pos))
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
redefinition of function `main.f`
|
builder error: redefinition of function `f`
|
||||||
vlib/v/checker/tests/fn_duplicate.vv:1:1: conflicting declaration: fn f()
|
vlib/v/checker/tests/fn_duplicate.vv:1:1: conflicting declaration: fn f()
|
||||||
1 | fn f() {
|
1 | fn f() {
|
||||||
| ~~~~~~
|
| ~~~~~~
|
||||||
2 |
|
2 | }
|
||||||
3 | }
|
3 |
|
||||||
vlib/v/checker/tests/fn_duplicate.vv:5:1: conflicting declaration: fn f(i int)
|
vlib/v/checker/tests/fn_duplicate.vv:4:1: conflicting declaration: fn f(i int)
|
||||||
3 | }
|
2 | }
|
||||||
4 |
|
3 |
|
||||||
5 | fn f(i int) {
|
4 | fn f(i int) {
|
||||||
| ~~~~~~~~~~~
|
| ~~~~~~~~~~~
|
||||||
6 |
|
5 | }
|
||||||
7 | }
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
fn f() {
|
fn f() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f(i int) {
|
fn f(i int) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -86,14 +86,18 @@ pub fn formatted_error(kind string, omsg string, filepath string, pos token.Pos)
|
|||||||
path = path.replace_once(util.normalised_workdir, '')
|
path = path.replace_once(util.normalised_workdir, '')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
position := '$path:${pos.line_nr + 1}:${mu.max(1, pos.col + 1)}:'
|
position := if filepath.len > 0 {
|
||||||
|
'$path:${pos.line_nr + 1}:${mu.max(1, pos.col + 1)}:'
|
||||||
|
} else {
|
||||||
|
''
|
||||||
|
}
|
||||||
scontext := source_file_context(kind, filepath, pos).join('\n')
|
scontext := source_file_context(kind, filepath, pos).join('\n')
|
||||||
final_position := bold(position)
|
final_position := bold(position)
|
||||||
final_kind := bold(color(kind, kind))
|
final_kind := bold(color(kind, kind))
|
||||||
final_msg := emsg
|
final_msg := emsg
|
||||||
final_context := if scontext.len > 0 { '\n$scontext' } else { '' }
|
final_context := if scontext.len > 0 { '\n$scontext' } else { '' }
|
||||||
//
|
|
||||||
return '$final_position $final_kind $final_msg$final_context'.trim_space()
|
return '$final_position $final_kind $final_msg$final_context'.trim_space()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user