mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
13 lines
199 B
V
13 lines
199 B
V
fn get[T](typ T) T {
|
|
return typ
|
|
}
|
|
|
|
fn get_string(typ string) string {
|
|
return 'boom'
|
|
}
|
|
|
|
fn test_generic_with_same_type() {
|
|
assert get_string('') == 'boom'
|
|
assert get[string]('hello') == 'hello'
|
|
}
|