1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: do not add braces for trailing struct arg (#7072)

This commit is contained in:
Lukas Neubert 2020-12-04 10:22:26 +01:00 committed by GitHub
parent 34049f7135
commit 02ba923ba7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 148 additions and 175 deletions

View File

@ -121,11 +121,7 @@ fn gg_init_sokol_window(user_data voidptr) {
exists := $if !android { os.is_file(g.config.font_path) } $else { true } exists := $if !android { os.is_file(g.config.font_path) } $else { true }
if g.config.font_path != '' && exists { if g.config.font_path != '' && exists {
// t := time.ticks() // t := time.ticks()
g.ft = new_ft({ g.ft = new_ft(font_path: g.config.font_path, custom_bold_font_path: g.config.custom_bold_font_path, scale: sapp.dpi_scale()) or {
font_path: g.config.font_path
custom_bold_font_path: g.config.custom_bold_font_path
scale: sapp.dpi_scale()
}) or {
panic(err) panic(err)
} }
// println('FT took ${time.ticks()-t} ms') // println('FT took ${time.ticks()-t} ms')

View File

@ -1637,9 +1637,7 @@ fn (mut c Checker) type_implements(typ table.Type, inter_typ table.Type, pos tok
for imethod in inter_sym.methods { for imethod in inter_sym.methods {
if method := typ_sym.find_method(imethod.name) { if method := typ_sym.find_method(imethod.name) {
if !imethod.is_same_method_as(method) { if !imethod.is_same_method_as(method) {
sig := c.table.fn_signature(imethod, { sig := c.table.fn_signature(imethod, skip_receiver: true)
skip_receiver: true
})
c.error('`$styp` incorrectly implements method `$imethod.name` of interface `$inter_sym.source_name`, expected `$sig`', c.error('`$styp` incorrectly implements method `$imethod.name` of interface `$inter_sym.source_name`, expected `$sig`',
pos) pos)
return false return false

View File

@ -312,21 +312,14 @@ pub fn (mut f Fmt) stmt(node ast.Stmt) {
} }
name := node.name.after('.') name := node.name.after('.')
f.writeln('enum $name {') f.writeln('enum $name {')
f.comments(node.comments, { f.comments(node.comments, inline: true, level: .indent)
inline: true
level: .indent
})
for field in node.fields { for field in node.fields {
f.write('\t$field.name') f.write('\t$field.name')
if field.has_expr { if field.has_expr {
f.write(' = ') f.write(' = ')
f.expr(field.expr) f.expr(field.expr)
} }
f.comments(field.comments, { f.comments(field.comments, inline: true, has_nl: false, level: .indent)
inline: true
has_nl: false
level: .indent
})
f.writeln('') f.writeln('')
} }
f.writeln('}\n') f.writeln('}\n')
@ -567,9 +560,7 @@ pub fn (mut f Fmt) type_decl(node ast.TypeDecl) {
} }
if comments.len > 0 { if comments.len > 0 {
f.write(' ') f.write(' ')
f.comments(comments, CommentsOptions{ f.comments(comments, has_nl: false)
has_nl: false
})
} }
f.writeln('\n') f.writeln('\n')
} }
@ -669,9 +660,7 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl) {
} else { } else {
f.write(' ') f.write(' ')
} }
f.comments(comments[comm_idx..], { f.comments(comments[comm_idx..], level: .indent)
level: .indent
})
} else { } else {
f.writeln('') f.writeln('')
} }
@ -685,9 +674,7 @@ pub fn (mut f Fmt) comments_after_last_field(comments []ast.Comment) {
for comment in comments { for comment in comments {
f.indent++ f.indent++
f.empty_line = true f.empty_line = true
f.comment(comment, { f.comment(comment, inline: true)
inline: true
})
f.writeln('') f.writeln('')
f.indent-- f.indent--
} }
@ -703,11 +690,7 @@ pub fn (mut f Fmt) interface_decl(node ast.InterfaceDecl) {
for method in node.methods { for method in node.methods {
f.write('\t') f.write('\t')
f.write(method.stringify(f.table, f.cur_mod).after('fn ')) f.write(method.stringify(f.table, f.cur_mod).after('fn '))
f.comments(method.comments, { f.comments(method.comments, inline: true, has_nl: false, level: .indent)
inline: true
has_nl: false
level: .indent
})
f.writeln('') f.writeln('')
} }
f.writeln('}\n') f.writeln('}\n')
@ -796,13 +779,9 @@ pub fn (mut f Fmt) expr(node ast.Expr) {
} }
ast.Comment { ast.Comment {
if f.array_init_depth > 0 { if f.array_init_depth > 0 {
f.comment(node, { f.comment(node, iembed: true)
iembed: true
})
} else { } else {
f.comment(node, { f.comment(node, inline: true)
inline: true
})
} }
} }
ast.ComptimeCall { ast.ComptimeCall {
@ -936,9 +915,7 @@ pub fn (mut f Fmt) expr(node ast.Expr) {
f.indent++ f.indent++
for branch in node.branches { for branch in node.branches {
if branch.comment.text != '' { if branch.comment.text != '' {
f.comment(branch.comment, { f.comment(branch.comment, inline: true)
inline: true
})
f.writeln('') f.writeln('')
} }
if branch.is_else { if branch.is_else {
@ -961,9 +938,7 @@ pub fn (mut f Fmt) expr(node ast.Expr) {
} }
f.writeln('}') f.writeln('}')
if branch.post_comments.len > 0 { if branch.post_comments.len > 0 {
f.comments(branch.post_comments, { f.comments(branch.post_comments, inline: true)
inline: true
})
} }
} }
f.indent-- f.indent--
@ -1433,9 +1408,7 @@ pub fn (mut f Fmt) if_expr(it ast.IfExpr) {
f.single_line_if = false f.single_line_if = false
if it.post_comments.len > 0 { if it.post_comments.len > 0 {
f.writeln('') f.writeln('')
f.comments(it.post_comments, { f.comments(it.post_comments, has_nl: false)
has_nl: false
})
} }
} }
@ -1444,15 +1417,14 @@ pub fn (mut f Fmt) at_expr(node ast.AtExpr) {
} }
pub fn (mut f Fmt) call_expr(node ast.CallExpr) { pub fn (mut f Fmt) call_expr(node ast.CallExpr) {
/* old_short_arg_state := f.use_short_fn_args
if node.args.len == 1 && node.expected_arg_types.len == 1 && node.args[0].expr is ast.StructInit && f.use_short_fn_args = false
node.args[0].typ == node.expected_arg_types[0] { if node.args.len > 0 && node.args.last().expr is ast.StructInit {
// struct_init := node.args[0].expr as ast.StructInit struct_typ := (node.args.last().expr as ast.StructInit).typ
// if struct_init.typ == node.args[0].typ { if struct_typ == table.void_type {
f.use_short_fn_args = true f.use_short_fn_args = true
// } }
} }
*/
for arg in node.args { for arg in node.args {
f.comments(arg.comments, {}) f.comments(arg.comments, {})
} }
@ -1528,7 +1500,7 @@ pub fn (mut f Fmt) call_expr(node ast.CallExpr) {
f.write(')') f.write(')')
f.or_expr(node.or_block) f.or_expr(node.or_block)
} }
f.use_short_fn_args = false f.use_short_fn_args = old_short_arg_state
} }
pub fn (mut f Fmt) match_expr(it ast.MatchExpr) { pub fn (mut f Fmt) match_expr(it ast.MatchExpr) {
@ -1555,9 +1527,7 @@ pub fn (mut f Fmt) match_expr(it ast.MatchExpr) {
} }
for branch in it.branches { for branch in it.branches {
for cmnt in branch.comments { for cmnt in branch.comments {
f.comment(cmnt, { f.comment(cmnt, inline: true)
inline: true
})
f.writeln('') f.writeln('')
} }
if !branch.is_else { if !branch.is_else {
@ -1568,9 +1538,7 @@ pub fn (mut f Fmt) match_expr(it ast.MatchExpr) {
if j < branch.ecmnts.len && branch.ecmnts[j].len > 0 { if j < branch.ecmnts.len && branch.ecmnts[j].len > 0 {
f.write(' ') f.write(' ')
for cmnt in branch.ecmnts[j] { for cmnt in branch.ecmnts[j] {
f.comment(cmnt, { f.comment(cmnt, iembed: true)
iembed: true
})
} }
} }
if j < branch.exprs.len - 1 { if j < branch.exprs.len - 1 {
@ -1599,9 +1567,7 @@ pub fn (mut f Fmt) match_expr(it ast.MatchExpr) {
} }
} }
if branch.post_comments.len > 0 { if branch.post_comments.len > 0 {
f.comments(branch.post_comments, { f.comments(branch.post_comments, inline: true)
inline: true
})
} }
} }
f.indent-- f.indent--
@ -1778,9 +1744,7 @@ pub fn (mut f Fmt) array_init(it ast.ArrayInit) {
if i < it.ecmnts.len && it.ecmnts[i].len > 0 { if i < it.ecmnts.len && it.ecmnts[i].len > 0 {
f.write(' ') f.write(' ')
for cmt in it.ecmnts[i] { for cmt in it.ecmnts[i] {
f.comment(cmt, { f.comment(cmt, iembed: true)
iembed: true
})
} }
} }
if i == it.exprs.len - 1 { if i == it.exprs.len - 1 {
@ -1844,29 +1808,31 @@ pub fn (mut f Fmt) struct_init(it ast.StructInit) {
} }
f.write('}') f.write('}')
} else { } else {
if f.use_short_fn_args { use_short_args := f.use_short_fn_args
f.writeln('') f.use_short_fn_args = false
} else { if !use_short_args {
f.writeln('$name{') f.writeln('$name{')
} }
f.comments(it.pre_comments, { f.comments(it.pre_comments, inline: true, has_nl: true, level: .indent)
inline: true
has_nl: true
level: .indent
})
f.indent++ f.indent++
for field in it.fields { single_line_short_args := use_short_args && it.fields.len < 4
f.write('$field.name: ') if use_short_args && !single_line_short_args {
f.prefix_expr_cast_expr(field.expr)
f.comments(field.comments, {
inline: true
has_nl: false
level: .indent
})
f.writeln('') f.writeln('')
} }
for i, field in it.fields {
f.write('$field.name: ')
f.prefix_expr_cast_expr(field.expr)
f.comments(field.comments, inline: true, has_nl: false, level: .indent)
if single_line_short_args {
if i < it.fields.len - 1 {
f.write(', ')
}
} else {
f.writeln('')
}
}
f.indent-- f.indent--
if !f.use_short_fn_args { if !use_short_args {
f.write('}') f.write('}')
} }
} }
@ -1888,9 +1854,7 @@ pub fn (mut f Fmt) const_decl(it ast.ConstDecl) {
comments := field.comments comments := field.comments
mut j := 0 mut j := 0
for j < comments.len && comments[j].pos.pos < field.pos.pos { for j < comments.len && comments[j].pos.pos < field.pos.pos {
f.comment(comments[j], { f.comment(comments[j], inline: true)
inline: true
})
f.writeln('') f.writeln('')
j++ j++
} }
@ -1928,9 +1892,7 @@ fn (mut f Fmt) global_decl(it ast.GlobalDecl) {
for field in it.fields { for field in it.fields {
comments := field.comments comments := field.comments
for comment in comments { for comment in comments {
f.comment(comment, { f.comment(comment, inline: true)
inline: true
})
f.writeln('') f.writeln('')
} }
f.write('$field.name ') f.write('$field.name ')

View File

@ -35,9 +35,7 @@ fn test_fmt() {
mut input_files := []string{} mut input_files := []string{}
input_files << keep_input_files input_files << keep_input_files
input_files << expected_input_files input_files << expected_input_files
input_files = vtest.filter_vtest_only(input_files, { input_files = vtest.filter_vtest_only(input_files, basepath: vroot)
basepath: vroot
})
fmt_bench.set_total_expected_steps(input_files.len) fmt_bench.set_total_expected_steps(input_files.len)
for istep, ipath in input_files { for istep, ipath in input_files {
fmt_bench.cstep = istep fmt_bench.cstep = istep

View File

@ -0,0 +1,32 @@
type Foo = Bar | Baz
struct Bar {
x string
y int
z int
a int
}
struct Baz {
x string
}
fn main() {
bar_func(x: 'bar', y: 13, z: 42)
foo_func(Baz{
x: 'Baz as Foo sumtype'
})
bar_func(
x: 'bar'
y: 2
z: 3
a: 4
)
func_from_other_file(val: 'something')
}
fn bar_func(bar Bar) {
}
fn foo_func(f Foo) {
}

View File

@ -4841,10 +4841,7 @@ fn (mut g Gen) gen_array_sort(node ast.CallExpr) {
compare_fn += '_reverse' compare_fn += '_reverse'
} }
// Register a new custom `compare_xxx` function for qsort() // Register a new custom `compare_xxx` function for qsort()
g.table.register_fn({ g.table.register_fn(name: compare_fn, return_type: table.int_type)
name: compare_fn
return_type: table.int_type
})
infix_expr := node.args[0].expr as ast.InfixExpr infix_expr := node.args[0].expr as ast.InfixExpr
styp := g.typ(typ) styp := g.typ(typ)
// Variables `a` and `b` are used in the `.sort(a < b)` syntax, so we can reuse them // Variables `a` and `b` are used in the `.sort(a < b)` syntax, so we can reuse them

View File

@ -377,7 +377,7 @@ fn (mut p Parser) interface_decl() ast.InterfaceDecl {
p.check(.lcbr) p.check(.lcbr)
pre_comments := p.eat_comments() pre_comments := p.eat_comments()
// Declare the type // Declare the type
reg_idx := p.table.register_type_symbol(table.TypeSymbol{ reg_idx := p.table.register_type_symbol(
kind: .interface_ kind: .interface_
name: interface_name name: interface_name
source_name: interface_name source_name: interface_name
@ -386,7 +386,7 @@ fn (mut p Parser) interface_decl() ast.InterfaceDecl {
info: table.Interface{ info: table.Interface{
types: [] types: []
} }
}) )
if reg_idx == -1 { if reg_idx == -1 {
p.error_with_pos('cannot register interface `$interface_name`, another type with this name exists', p.error_with_pos('cannot register interface `$interface_name`, another type with this name exists',
name_pos) name_pos)
@ -434,13 +434,13 @@ fn (mut p Parser) interface_decl() ast.InterfaceDecl {
methods << method methods << method
// println('register method $name') // println('register method $name')
return_type_sym := p.table.get_type_symbol(method.return_type) return_type_sym := p.table.get_type_symbol(method.return_type)
ts.register_method(table.Fn{ ts.register_method(
name: name name: name
params: args params: args
return_type: method.return_type return_type: method.return_type
return_type_source_name: return_type_sym.source_name return_type_source_name: return_type_sym.source_name
is_pub: true is_pub: true
}) )
} }
p.top_level_statement_end() p.top_level_statement_end()
p.check(.rcbr) p.check(.rcbr)

View File

@ -619,7 +619,7 @@ pub fn (mut t Table) find_or_register_fn_type(mod string, f Fn, is_anon bool, ha
name := if f.name.len == 0 { 'anon_fn_$f.signature()' } else { f.name.clone() } name := if f.name.len == 0 { 'anon_fn_$f.signature()' } else { f.name.clone() }
source_name := if f.name.len == 0 { 'fn $f.source_signature()' } else { f.name.clone() } source_name := if f.name.len == 0 { 'fn $f.source_signature()' } else { f.name.clone() }
anon := f.name.len == 0 || is_anon anon := f.name.len == 0 || is_anon
return t.register_type_symbol(TypeSymbol{ return t.register_type_symbol(
kind: .function kind: .function
name: name name: name
source_name: source_name source_name: source_name
@ -630,7 +630,7 @@ pub fn (mut t Table) find_or_register_fn_type(mod string, f Fn, is_anon bool, ha
has_decl: has_decl has_decl: has_decl
func: f func: f
} }
}) )
} }
pub fn (mut t Table) add_placeholder_type(name string, language Language) int { pub fn (mut t Table) add_placeholder_type(name string, language Language) int {

View File

@ -498,218 +498,215 @@ pub fn (t TypeSymbol) str() string {
pub fn (mut t Table) register_builtin_type_symbols() { pub fn (mut t Table) register_builtin_type_symbols() {
// reserve index 0 so nothing can go there // reserve index 0 so nothing can go there
// save index check, 0 will mean not found // save index check, 0 will mean not found
t.register_type_symbol({ t.register_type_symbol(kind: .placeholder, name: 'reserved_0')
kind: .placeholder t.register_type_symbol(
name: 'reserved_0'
})
t.register_type_symbol(TypeSymbol{
kind: .void kind: .void
name: 'void' name: 'void'
source_name: 'void' source_name: 'void'
cname: 'void' cname: 'void'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .voidptr kind: .voidptr
name: 'voidptr' name: 'voidptr'
source_name: 'voidptr' source_name: 'voidptr'
cname: 'voidptr' cname: 'voidptr'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .byteptr kind: .byteptr
name: 'byteptr' name: 'byteptr'
source_name: 'byteptr' source_name: 'byteptr'
cname: 'byteptr' cname: 'byteptr'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .charptr kind: .charptr
name: 'charptr' name: 'charptr'
source_name: 'charptr' source_name: 'charptr'
cname: 'charptr' cname: 'charptr'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .i8 kind: .i8
name: 'i8' name: 'i8'
source_name: 'i8' source_name: 'i8'
cname: 'i8' cname: 'i8'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .i16 kind: .i16
name: 'i16' name: 'i16'
source_name: 'i16' source_name: 'i16'
cname: 'i16' cname: 'i16'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .int kind: .int
name: 'int' name: 'int'
source_name: 'int' source_name: 'int'
cname: 'int' cname: 'int'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .i64 kind: .i64
name: 'i64' name: 'i64'
source_name: 'i64' source_name: 'i64'
cname: 'i64' cname: 'i64'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .byte kind: .byte
name: 'byte' name: 'byte'
source_name: 'byte' source_name: 'byte'
cname: 'byte' cname: 'byte'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .u16 kind: .u16
name: 'u16' name: 'u16'
source_name: 'u16' source_name: 'u16'
cname: 'u16' cname: 'u16'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .u32 kind: .u32
name: 'u32' name: 'u32'
source_name: 'u32' source_name: 'u32'
cname: 'u32' cname: 'u32'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .u64 kind: .u64
name: 'u64' name: 'u64'
source_name: 'u64' source_name: 'u64'
cname: 'u64' cname: 'u64'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .f32 kind: .f32
name: 'f32' name: 'f32'
source_name: 'f32' source_name: 'f32'
cname: 'f32' cname: 'f32'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .f64 kind: .f64
name: 'f64' name: 'f64'
source_name: 'f64' source_name: 'f64'
cname: 'f64' cname: 'f64'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .char kind: .char
name: 'char' name: 'char'
source_name: 'char' source_name: 'char'
cname: 'char' cname: 'char'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .bool kind: .bool
name: 'bool' name: 'bool'
cname: 'bool' cname: 'bool'
source_name: 'bool' source_name: 'bool'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .none_ kind: .none_
name: 'none' name: 'none'
source_name: 'none' source_name: 'none'
cname: 'none' cname: 'none'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .string kind: .string
name: 'string' name: 'string'
source_name: 'string' source_name: 'string'
cname: 'string' cname: 'string'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .ustring kind: .ustring
name: 'ustring' name: 'ustring'
source_name: 'ustring' source_name: 'ustring'
cname: 'ustring' cname: 'ustring'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .array kind: .array
name: 'array' name: 'array'
source_name: 'array' source_name: 'array'
cname: 'array' cname: 'array'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .map kind: .map
name: 'map' name: 'map'
source_name: 'map' source_name: 'map'
cname: 'map' cname: 'map'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .chan kind: .chan
name: 'chan' name: 'chan'
source_name: 'chan' source_name: 'chan'
cname: 'chan' cname: 'chan'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .size_t kind: .size_t
name: 'size_t' name: 'size_t'
source_name: 'size_t' source_name: 'size_t'
cname: 'size_t' cname: 'size_t'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .rune kind: .rune
name: 'rune' name: 'rune'
source_name: 'rune' source_name: 'rune'
cname: 'rune' cname: 'rune'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .any kind: .any
name: 'any' name: 'any'
source_name: 'any' source_name: 'any'
cname: 'any' cname: 'any'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .any_float kind: .any_float
name: 'any_float' name: 'any_float'
source_name: 'any_float' source_name: 'any_float'
cname: 'any_float' cname: 'any_float'
mod: 'builtin' mod: 'builtin'
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .any_int kind: .any_int
name: 'any_int' name: 'any_int'
source_name: 'any_int' source_name: 'any_int'
cname: 'any_int' cname: 'any_int'
mod: 'builtin' mod: 'builtin'
}) )
// TODO: remove. for v1 map compatibility // TODO: remove. for v1 map compatibility
map_string_string_idx := t.find_or_register_map(string_type, string_type) map_string_string_idx := t.find_or_register_map(string_type, string_type)
map_string_int_idx := t.find_or_register_map(string_type, int_type) map_string_int_idx := t.find_or_register_map(string_type, int_type)
t.register_type_symbol({ t.register_type_symbol(
kind: .alias kind: .alias
name: 'map_string' name: 'map_string'
source_name: 'map_string' source_name: 'map_string'
cname: 'map_string' cname: 'map_string'
mod: 'builtin' mod: 'builtin'
parent_idx: map_string_string_idx parent_idx: map_string_string_idx
}) )
t.register_type_symbol({ t.register_type_symbol(
kind: .alias kind: .alias
name: 'map_int' name: 'map_int'
source_name: 'map_int' source_name: 'map_int'
cname: 'map_int' cname: 'map_int'
mod: 'builtin' mod: 'builtin'
parent_idx: map_string_int_idx parent_idx: map_string_int_idx
}) )
} }
[inline] [inline]
@ -929,9 +926,7 @@ pub fn (table &Table) type_to_str(t Type) string {
.function { .function {
if !table.is_fmt { if !table.is_fmt {
info := sym.info as FnType info := sym.info as FnType
res = table.fn_signature(info.func, { res = table.fn_signature(info.func, type_only: true)
type_only: true
})
} }
} }
.map { .map {

View File

@ -23,9 +23,7 @@ fn get_tests_in_dir(dir string) []string {
fn check_path(vexe string, dir string, tests []string) int { fn check_path(vexe string, dir string, tests []string) int {
mut nb_fail := 0 mut nb_fail := 0
paths := vtest.filter_vtest_only(tests, { paths := vtest.filter_vtest_only(tests, basepath: dir)
basepath: dir
})
for path in paths { for path in paths {
program := path program := path
print(path + ' ') print(path + ' ')

View File

@ -130,10 +130,7 @@ fn (mut mcache ModFileCacher) mark_folders_as_vmod_free(folders_so_far []string)
// No need to check these folders anymore, // No need to check these folders anymore,
// because their parents do not contain v.mod files // because their parents do not contain v.mod files
for f in folders_so_far { for f in folders_so_far {
mcache.add(f, ModFileAndFolder{ mcache.add(f, vmod_file: '', vmod_folder: f)
vmod_file: ''
vmod_folder: f
})
} }
} }