mirror of
https://github.com/vlang/v.git
synced 2025-09-24 04:48:28 -04:00
parent
07997816d9
commit
eaf005e29f
@ -1,18 +0,0 @@
|
||||
import math
|
||||
import os
|
||||
import math
|
||||
// keep comment
|
||||
import gg
|
||||
import gg { MouseButton }
|
||||
import time { Duration }
|
||||
import time { Duration }
|
||||
import math.complex { Complex }
|
||||
import math.complex { Complex }
|
||||
|
||||
const mypi = math.pi
|
||||
const mb = MouseButton{}
|
||||
const complex = Complex{}
|
||||
|
||||
fn main() {
|
||||
println(os.path_separator)
|
||||
}
|
@ -310,6 +310,11 @@ fn (mut p Parser) import_syms(mut parent ast.Import) {
|
||||
for p.tok.kind == .name {
|
||||
pos := p.tok.pos()
|
||||
alias := p.check_name()
|
||||
if alias in p.imported_symbols {
|
||||
p.error_with_pos('cannot register symbol `${alias}`, it was already imported',
|
||||
pos)
|
||||
return
|
||||
}
|
||||
p.imported_symbols[alias] = parent.mod + '.' + alias
|
||||
// so we can work with this in fmt+checker
|
||||
parent.syms << ast.ImportSymbol{
|
||||
|
3
vlib/v/parser/tests/module_import_same_symbol2_err.out
Normal file
3
vlib/v/parser/tests/module_import_same_symbol2_err.out
Normal file
@ -0,0 +1,3 @@
|
||||
vlib/v/parser/tests/module_import_same_symbol2_err.vv:1:20: error: cannot register symbol `max`, it was already imported
|
||||
1 | import math { max, max }
|
||||
| ~~~
|
1
vlib/v/parser/tests/module_import_same_symbol2_err.vv
Normal file
1
vlib/v/parser/tests/module_import_same_symbol2_err.vv
Normal file
@ -0,0 +1 @@
|
||||
import math { max, max }
|
4
vlib/v/parser/tests/module_import_same_symbol_err.out
Normal file
4
vlib/v/parser/tests/module_import_same_symbol_err.out
Normal file
@ -0,0 +1,4 @@
|
||||
vlib/v/parser/tests/module_import_same_symbol_err.vv:2:17: error: cannot register symbol `max`, it was already imported
|
||||
1 | import math { max }
|
||||
2 | import arrays { max }
|
||||
| ~~~
|
2
vlib/v/parser/tests/module_import_same_symbol_err.vv
Normal file
2
vlib/v/parser/tests/module_import_same_symbol_err.vv
Normal file
@ -0,0 +1,2 @@
|
||||
import math { max }
|
||||
import arrays { max }
|
Loading…
x
Reference in New Issue
Block a user