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

parser: fix generic function call in for in expression

This commit is contained in:
Johan Hillerström
2019-12-16 23:08:30 +01:00
committed by Alexander Medvednikov
parent 3dbf7a4039
commit 6008fa44c6
3 changed files with 28 additions and 1 deletions

View File

@ -80,3 +80,21 @@ fn test_generic_method() {
p.translate(2, 1.0)
assert p.x == 2.0 && p.y == 1.0
}
fn get_values<T>(i T) []T {
return [i]
}
fn test_generic_fn_in_for_in_expression() {
for value in get_values(1) {
assert value == 1
}
for i, val in get_values(0) {
assert i == val
}
for value in get_values('a') {
assert value == 'a'
}
}