From 3d22dc1608994c16835b7b3fae930136094a6d68 Mon Sep 17 00:00:00 2001 From: yuyi Date: Wed, 18 Aug 2021 22:17:21 +0800 Subject: [PATCH] all: fix formating Foo to Foo (#11225) --- vlib/v/ast/table.v | 4 ++-- vlib/v/checker/checker.v | 2 +- vlib/v/checker/tests/generic_sumtype_invalid_variant.out | 4 ++-- vlib/v/fmt/tests/generic_structs_keep.vv | 2 +- vlib/v/parser/parse_type.v | 2 +- .../tests/generics_interface_with_multi_generic_types_test.v | 2 +- vlib/v/tests/generics_return_multiple_generics_struct_test.v | 2 +- vlib/v/tests/generics_with_anon_generics_fn_test.v | 2 +- .../generics_with_multiple_generics_struct_receiver_test.v | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/vlib/v/ast/table.v b/vlib/v/ast/table.v index 5c3269a757..30715d6d8d 100644 --- a/vlib/v/ast/table.v +++ b/vlib/v/ast/table.v @@ -202,7 +202,7 @@ pub fn (t &Table) fn_type_signature(f &Fn) string { typ := arg.typ.set_nr_muls(0) arg_type_sym := t.get_type_symbol(typ) sig += arg_type_sym.str().to_lower().replace_each(['.', '__', '&', '', '[]', 'arr_', 'chan ', - 'chan_', 'map[', 'map_of_', ']', '_to_', '<', '_T_', ',', '_', '>', '']) + 'chan_', 'map[', 'map_of_', ']', '_to_', '<', '_T_', ',', '_', ' ', '', '>', '']) if i < f.params.len - 1 { sig += '_' } @@ -1433,7 +1433,7 @@ pub fn (mut t Table) resolve_generic_to_concrete(generic_type Type, generic_name gts := t.get_type_symbol(ct) nrt += gts.name if i != sym.info.generic_types.len - 1 { - nrt += ',' + nrt += ', ' } } } diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 00a119225b..24398ae92e 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -696,7 +696,7 @@ fn (mut c Checker) unwrap_generic_type(typ ast.Type, generic_names []string, con nrt += gts.name c_nrt += gts.cname if i != ts.info.generic_types.len - 1 { - nrt += ',' + nrt += ', ' c_nrt += '_' } } diff --git a/vlib/v/checker/tests/generic_sumtype_invalid_variant.out b/vlib/v/checker/tests/generic_sumtype_invalid_variant.out index c82df9e661..72bd5932da 100644 --- a/vlib/v/checker/tests/generic_sumtype_invalid_variant.out +++ b/vlib/v/checker/tests/generic_sumtype_invalid_variant.out @@ -1,11 +1,11 @@ -vlib/v/checker/tests/generic_sumtype_invalid_variant.vv:5:7: error: `MultiGeneric` has no variant `u64` +vlib/v/checker/tests/generic_sumtype_invalid_variant.vv:5:7: error: `MultiGeneric` has no variant `u64` 3 | fn main() { 4 | mut m := MultiGeneric(true) 5 | if m is u64 { | ~~ 6 | println('hi') 7 | } -vlib/v/checker/tests/generic_sumtype_invalid_variant.vv:8:7: error: `MultiGeneric` has no variant `X` +vlib/v/checker/tests/generic_sumtype_invalid_variant.vv:8:7: error: `MultiGeneric` has no variant `X` 6 | println('hi') 7 | } 8 | if m is X { diff --git a/vlib/v/fmt/tests/generic_structs_keep.vv b/vlib/v/fmt/tests/generic_structs_keep.vv index a27c3faeaa..c021c7c763 100644 --- a/vlib/v/fmt/tests/generic_structs_keep.vv +++ b/vlib/v/fmt/tests/generic_structs_keep.vv @@ -31,7 +31,7 @@ fn main() { assert foo_int.value() == '2' println(foo_int) // - x := Repo{'abc', 3, 1.5} + x := Repo{'abc', 3, 1.5} println(x.db) println(x.model) println(x.permission) diff --git a/vlib/v/parser/parse_type.v b/vlib/v/parser/parse_type.v index 511682f069..6278e033ea 100644 --- a/vlib/v/parser/parse_type.v +++ b/vlib/v/parser/parse_type.v @@ -543,7 +543,7 @@ pub fn (mut p Parser) parse_generic_inst_type(name string) ast.Type { break } p.next() - bs_name += ',' + bs_name += ', ' bs_cname += '_' } p.check(.gt) diff --git a/vlib/v/tests/generics_interface_with_multi_generic_types_test.v b/vlib/v/tests/generics_interface_with_multi_generic_types_test.v index 7a88789c63..d6e7f59151 100644 --- a/vlib/v/tests/generics_interface_with_multi_generic_types_test.v +++ b/vlib/v/tests/generics_interface_with_multi_generic_types_test.v @@ -20,7 +20,7 @@ fn (mut it ArrIter) next() ?(T, U) { } fn iter(t []T, u []U) Iter { - return ArrIter{ + return ArrIter{ t: t u: u } diff --git a/vlib/v/tests/generics_return_multiple_generics_struct_test.v b/vlib/v/tests/generics_return_multiple_generics_struct_test.v index 3b30a564e7..4470226318 100644 --- a/vlib/v/tests/generics_return_multiple_generics_struct_test.v +++ b/vlib/v/tests/generics_return_multiple_generics_struct_test.v @@ -5,7 +5,7 @@ mut: } fn new_foo(a A, b B) Foo { - return Foo{ + return Foo{ a: a b: b } diff --git a/vlib/v/tests/generics_with_anon_generics_fn_test.v b/vlib/v/tests/generics_with_anon_generics_fn_test.v index 893ea8e9fa..b5bde8f089 100644 --- a/vlib/v/tests/generics_with_anon_generics_fn_test.v +++ b/vlib/v/tests/generics_with_anon_generics_fn_test.v @@ -50,7 +50,7 @@ fn test_generics_with_anon_generics_fn() { assert call(consume, 1) == 1 assert call(consume_str, '1') == '1' - pair := Pair{1, 's'} + pair := Pair{1, 's'} assert call(fn (v Pair) Pair { return v }, pair) == pair diff --git a/vlib/v/tests/generics_with_multiple_generics_struct_receiver_test.v b/vlib/v/tests/generics_with_multiple_generics_struct_receiver_test.v index 1e8417e9dd..32783d4f66 100644 --- a/vlib/v/tests/generics_with_multiple_generics_struct_receiver_test.v +++ b/vlib/v/tests/generics_with_multiple_generics_struct_receiver_test.v @@ -12,7 +12,7 @@ fn (num Foo) get_foo2() (A, B) { } fn test_generics_with_multi_generics_struct_receiver() { - num := Foo{ + num := Foo{ a: 3 b: 'aaa' }