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

vrepl: fix output errors (fix #15801) (#15804)

This commit is contained in:
yuyi 2022-09-18 19:09:31 +08:00 committed by GitHub
parent d67aa8d76c
commit c78344ef04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -494,7 +494,9 @@ fn run_repl(workdir string, vrepl_prefix string) int {
}
if s.output.len > r.last_output.len {
len := r.last_output.len
r.last_output = s.output.clone()
if s.exit_code == 0 {
r.last_output = s.output.clone()
}
cur_line_output := s.output[len..]
print_output(cur_line_output)
}

View File

@ -0,0 +1,15 @@
a = 3
b
[4, 5].filter(it < 5)
===output===
error: undefined ident: `a` (use `:=` to declare a variable)
5 | import math
6 |
7 | a = 3
| ^
error: undefined ident: `b`
5 | import math
6 |
7 | println(b)
| ^
[4]