V version: This as a base: https://github.com/vlang/v/pull/7043/checks?check_run_id=1473963793
OS: Ubuntu
What did you do?
module main
import v.parser
import v.table
import v.pref
import v.ast
fn main() {
scope := ast.Scope{
parent: 0
}
pref := pref.Preferences{}
table := table.new_table()
code := 'module main
fn main() {
println(\'Hello World\')
}
'
parsed_file := parser.parse_text(code, &table, .parse_comments, &pref, &scope)
println(parsed_file.warnings)
}
What did you expect to see?
Either it works or an V error.
What did you see instead?
segfault
This works
module main
import v.parser
import v.table
import v.pref
import v.ast
fn main() {
scope := ast.Scope{
parent: 0
}
pref := pref.Preferences{}
table := table.new_table()
code := 'module main
fn main() {
println(\'Hello World\')
}
'
// changed this line
parsed_file := parser.parse_text(code, table, .parse_comments, &pref, &scope)
println(parsed_file.warnings)
}
table.new_table() already outputs &Table
&table would just result to being &&Table
V should return an error for this
Great find, very important bug to fix.
Most helpful comment
table.new_table()already outputs&Table&tablewould just result to being&&TableV should return an error for this