| 1 |
// testing overloaded functions to return different types |
| 2 |
// 1.5.2.0 -- reinstated |
| 3 |
|
| 4 |
// a custom class |
| 5 |
public class Foo { int num; } |
| 6 |
|
| 7 |
fun Foo @operator =>( Foo lhs, Foo rhs ) |
| 8 |
{ /* do stuff for Foo => Foo */ return rhs; } |
| 9 |
|
| 10 |
fun int @operator =>( int lhs, int rhs ) |
| 11 |
{ /* do stuff for Foo => Foo */ return rhs; } |
| 12 |
|
| 13 |
// foo() overload 1 returns float |
| 14 |
fun float foo( float b ) { return b; } |
| 15 |
|
| 16 |
// foo() overload 2 returns int |
| 17 |
fun int foo( int a ) { return a; } |
| 18 |
|
| 19 |
|
| 20 |
if( Type.of(foo(1)).name() == "int" && |
| 21 |
Type.of(foo(2.0)).name() == "float" ) <<< "success" >>>; |