parent
913164bc73
commit
28b0cbddad
|
@ -1,5 +0,0 @@
|
|||
vlib/v/checker/tests/main_and_script_err.vv:1:1: error: function `main` is already defined
|
||||
1 | fn main() {
|
||||
| ^
|
||||
2 | println('main')
|
||||
3 | }
|
|
@ -693,6 +693,10 @@ pub fn (mut p Parser) top_stmt() ast.Stmt {
|
|||
p.script_mode = true
|
||||
p.script_mode_start_token = p.tok
|
||||
|
||||
if p.table.known_fn('main.main') {
|
||||
p.error('function `main` is already defined, put your script statements inside it')
|
||||
}
|
||||
|
||||
p.open_scope()
|
||||
mut stmts := []ast.Stmt{}
|
||||
for p.tok.kind != .eof {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
vlib/v/parser/tests/main_and_script_err.vv:4:1: error: function `main` is already defined, put your script statements inside it
|
||||
2 | println('main')
|
||||
3 | }
|
||||
4 | println('out')
|
||||
| ~~~~~~~
|
Loading…
Reference in New Issue