This commit is contained in:
parent
6162c8e042
commit
728148ae42
18
tests/_fn_with_generics.ethlang
Normal file
18
tests/_fn_with_generics.ethlang
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
fn identity<T>(v: T) -> T {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main()
|
||||||
|
{
|
||||||
|
let a = identity::<i32>(123);
|
||||||
|
// expect: 123
|
||||||
|
print(a);
|
||||||
|
|
||||||
|
let b = identity("abc");
|
||||||
|
// expect: abc
|
||||||
|
print(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: syntax=rust commentstring=//\ %s
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user