all: fix formating Foo<A,B> to Foo<A, B> (#11225)

pull/11234/head
yuyi 2021-08-18 22:17:21 +08:00 committed by GitHub
parent 881510e7ce
commit 3d22dc1608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 11 deletions

View File

@ -202,7 +202,7 @@ pub fn (t &Table) fn_type_signature(f &Fn) string {
typ := arg.typ.set_nr_muls(0) typ := arg.typ.set_nr_muls(0)
arg_type_sym := t.get_type_symbol(typ) arg_type_sym := t.get_type_symbol(typ)
sig += arg_type_sym.str().to_lower().replace_each(['.', '__', '&', '', '[]', 'arr_', 'chan ', 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 { if i < f.params.len - 1 {
sig += '_' 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) gts := t.get_type_symbol(ct)
nrt += gts.name nrt += gts.name
if i != sym.info.generic_types.len - 1 { if i != sym.info.generic_types.len - 1 {
nrt += ',' nrt += ', '
} }
} }
} }

View File

@ -696,7 +696,7 @@ fn (mut c Checker) unwrap_generic_type(typ ast.Type, generic_names []string, con
nrt += gts.name nrt += gts.name
c_nrt += gts.cname c_nrt += gts.cname
if i != ts.info.generic_types.len - 1 { if i != ts.info.generic_types.len - 1 {
nrt += ',' nrt += ', '
c_nrt += '_' c_nrt += '_'
} }
} }

View File

@ -1,11 +1,11 @@
vlib/v/checker/tests/generic_sumtype_invalid_variant.vv:5:7: error: `MultiGeneric<bool,int,string>` has no variant `u64` vlib/v/checker/tests/generic_sumtype_invalid_variant.vv:5:7: error: `MultiGeneric<bool, int, string>` has no variant `u64`
3 | fn main() { 3 | fn main() {
4 | mut m := MultiGeneric<bool, int, string>(true) 4 | mut m := MultiGeneric<bool, int, string>(true)
5 | if m is u64 { 5 | if m is u64 {
| ~~ | ~~
6 | println('hi') 6 | println('hi')
7 | } 7 | }
vlib/v/checker/tests/generic_sumtype_invalid_variant.vv:8:7: error: `MultiGeneric<bool,int,string>` has no variant `X` vlib/v/checker/tests/generic_sumtype_invalid_variant.vv:8:7: error: `MultiGeneric<bool, int, string>` has no variant `X`
6 | println('hi') 6 | println('hi')
7 | } 7 | }
8 | if m is X { 8 | if m is X {

View File

@ -31,7 +31,7 @@ fn main() {
assert foo_int.value() == '2' assert foo_int.value() == '2'
println(foo_int) println(foo_int)
// //
x := Repo<int,f64>{'abc', 3, 1.5} x := Repo<int, f64>{'abc', 3, 1.5}
println(x.db) println(x.db)
println(x.model) println(x.model)
println(x.permission) println(x.permission)

View File

@ -543,7 +543,7 @@ pub fn (mut p Parser) parse_generic_inst_type(name string) ast.Type {
break break
} }
p.next() p.next()
bs_name += ',' bs_name += ', '
bs_cname += '_' bs_cname += '_'
} }
p.check(.gt) p.check(.gt)

View File

@ -20,7 +20,7 @@ fn (mut it ArrIter<T, U>) next<T, U>() ?(T, U) {
} }
fn iter<T, U>(t []T, u []U) Iter<T, U> { fn iter<T, U>(t []T, u []U) Iter<T, U> {
return ArrIter<T,U>{ return ArrIter<T, U>{
t: t t: t
u: u u: u
} }

View File

@ -5,7 +5,7 @@ mut:
} }
fn new_foo<A, B>(a A, b B) Foo<A, B> { fn new_foo<A, B>(a A, b B) Foo<A, B> {
return Foo<A,B>{ return Foo<A, B>{
a: a a: a
b: b b: b
} }

View File

@ -50,7 +50,7 @@ fn test_generics_with_anon_generics_fn() {
assert call(consume, 1) == 1 assert call(consume, 1) == 1
assert call(consume_str, '1') == '1' assert call(consume_str, '1') == '1'
pair := Pair<int,string>{1, 's'} pair := Pair<int, string>{1, 's'}
assert call(fn (v Pair<int, string>) Pair<int, string> { assert call(fn (v Pair<int, string>) Pair<int, string> {
return v return v
}, pair) == pair }, pair) == pair

View File

@ -12,7 +12,7 @@ fn (num Foo<A, B>) get_foo2<B, A>() (A, B) {
} }
fn test_generics_with_multi_generics_struct_receiver() { fn test_generics_with_multi_generics_struct_receiver() {
num := Foo<int,string>{ num := Foo<int, string>{
a: 3 a: 3
b: 'aaa' b: 'aaa'
} }