parser: do not fail on comment direct after import (#7071)
parent
394e9c4c56
commit
8adc8ed103
|
@ -1,4 +1,4 @@
|
||||||
vlib/v/checker/comparing_typesymbol_to_a_type_should_not_compile.vv:12:12: error: possible type mismatch of compared values of `==` operation
|
vlib/v/checker/tests/comparing_typesymbol_to_a_type_should_not_compile.vv:12:12: error: possible type mismatch of compared values of `==` operation
|
||||||
10 | x := ityp == table.string_type
|
10 | x := ityp == table.string_type
|
||||||
11 | // the next line should produce at least a warning, or even an error, without an explicit cast:
|
11 | // the next line should produce at least a warning, or even an error, without an explicit cast:
|
||||||
12 | z := isym == table.string_type
|
12 | z := isym == table.string_type
|
|
@ -0,0 +1,5 @@
|
||||||
|
import semver
|
||||||
|
|
||||||
|
// as semver
|
||||||
|
fn main() {
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
import semver// as semver
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
}
|
|
@ -1624,7 +1624,7 @@ fn (mut p Parser) import_stmt() ast.Import {
|
||||||
}
|
}
|
||||||
pos_t := p.tok.position()
|
pos_t := p.tok.position()
|
||||||
if import_pos.line_nr == pos_t.line_nr {
|
if import_pos.line_nr == pos_t.line_nr {
|
||||||
if p.tok.kind !in [.lcbr, .eof] {
|
if p.tok.kind !in [.lcbr, .eof, .comment] {
|
||||||
p.error_with_pos('cannot import multiple modules at a time', pos_t)
|
p.error_with_pos('cannot import multiple modules at a time', pos_t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue