Skip to content

Commit 4c827f3

Browse files
committed
repl: fix typeof(a) with warning
1 parent 2c42574 commit 4c827f3

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

cmd/tools/vrepl.v

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ fn run_repl(workdir string, vrepl_prefix string) int {
533533
if s.output.len > r.last_output.len {
534534
cur_line_output := s.output[r.last_output.len..]
535535
print_output(cur_line_output)
536-
if s.exit_code == 0 {
536+
if s.exit_code == 0 && !cur_line_output.contains('warning:') {
537537
r.last_output = s.output.clone()
538538
r.lines << r.line
539539
}
@@ -583,8 +583,10 @@ fn run_repl(workdir string, vrepl_prefix string) int {
583583
if s.output.len > r.last_output.len {
584584
cur_line_output := s.output[r.last_output.len..]
585585
print_output(cur_line_output)
586-
r.last_output = s.output.clone()
587-
r.lines << print_line
586+
if !cur_line_output.contains('warning:') {
587+
r.last_output = s.output.clone()
588+
r.lines << print_line
589+
}
588590
}
589591
continue
590592
} else {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
a := error('hi')
2+
typeof(a)
3+
typeof(a)
4+
typeof(a)
5+
print(typeof(a))
6+
print(typeof(a))
7+
print(typeof(a))
8+
===output===
9+
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
10+
6 |
11+
7 | a := error('hi')
12+
8 | println(typeof(a))
13+
| ~~~~~~
14+
IError
15+
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
16+
6 |
17+
7 | a := error('hi')
18+
8 | println(typeof(a))
19+
| ~~~~~~
20+
IError
21+
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
22+
6 |
23+
7 | a := error('hi')
24+
8 | println(typeof(a))
25+
| ~~~~~~
26+
IError
27+
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
28+
6 |
29+
7 | a := error('hi')
30+
8 | print(typeof(a))
31+
| ~~~~~~
32+
IError
33+
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
34+
6 |
35+
7 | a := error('hi')
36+
8 | print(typeof(a))
37+
| ~~~~~~
38+
IError
39+
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
40+
6 |
41+
7 | a := error('hi')
42+
8 | print(typeof(a))
43+
| ~~~~~~
44+
IError

0 commit comments

Comments
 (0)