diff --git a/cmd/tools/vrepl.v b/cmd/tools/vrepl.v index df56365887..dfe968a9c3 100644 --- a/cmd/tools/vrepl.v +++ b/cmd/tools/vrepl.v @@ -148,7 +148,7 @@ fn run_repl(workdir string, vrepl_prefix string) { // but don't add this print call to the `lines` array, // so that it doesn't get called during the next print. if r.line.starts_with('print') { - source_code := r.functions.join('\n') + r.lines.join('\n') + '\n' + r.line + source_code := r.functions.join('\n') + r.lines.join('\n') + '\n' + r.line + '\n' os.write_file(file, source_code) s := os.exec('"$vexe" -repl run $file') or { rerror(err) diff --git a/vlib/v/tests/repl/error.repl b/vlib/v/tests/repl/error.repl index 92e77e442c..db674c3b6c 100644 --- a/vlib/v/tests/repl/error.repl +++ b/vlib/v/tests/repl/error.repl @@ -1,6 +1,6 @@ println(a) ===output=== -.vrepl.v:2:20: error: undefined: `a` +.vrepl.v:2:9: error: undefined: `a` 1 | 2 | println(a) - | + | ^