tests: simple<string> generics test

pull/4967/head
Alexander Medvednikov 2020-05-21 04:56:36 +02:00
parent ce1a181699
commit 45c9ccfc03
2 changed files with 2 additions and 1 deletions

View File

@ -443,7 +443,7 @@ fn (mut g Gen) fn_call(node ast.CallExpr) {
// `json__encode` => `json__encode_User` // `json__encode` => `json__encode_User`
name += '_' + json_type_str.replace('.', '__') name += '_' + json_type_str.replace('.', '__')
} }
if node.generic_type != table.void_type { if node.generic_type != table.void_type && node.generic_type != 0 {
// `foo<int>()` => `foo_int()` // `foo<int>()` => `foo_int()`
name += '_' + g.typ(node.generic_type) name += '_' + g.typ(node.generic_type)
} }

View File

@ -7,6 +7,7 @@ fn simple<T>(p T) T {
fn test_generic_fn() { fn test_generic_fn() {
assert simple<int>(1) == 1 assert simple<int>(1) == 1
assert simple<string>('g') == 'g'
} }
/* /*