ceylon/ceylon-compiler — Issue #333: Interop: overloaded method return types are broken when type parameters
Author: FroMage
Created: 2012-01-25 10:20:18+00:00
State: open
Labels: BUG, high priority, model-loader

When I have two overloaded methods in Java:

```java
int m();
T m(T t);
```

The model loader will attempt to make a union type of all return types `int|T` for every instance of `m` but it will only try to look T up in the current instance of `m`, so this will work for the second but fail for the first with a missing type parameter declaration.

This sort of strategy seems a bit fubar to me though, because surely the return type of an overloaded method can be computed by the type checker and we don't need to deal with union types. Also I wonder how it would deal with:

```java
T m();
T m(T t);
```