When using optional parameters in the constructor of a generic class, Manifold fails to correctly infer the generic type during instantiation. This leads to type inference errors in IntelliJ, even though the generic type is explicitly declared on the variable.
public static class MyClass<T> {
private T t;
public MyClass(T t=null, int i=5) {
this.t = t;
}
}
MyClass<String> myClass = new MyClass<>(i:3); // IntelliJ error: Incompatible equality constraint: String and Object
This suggests that the type T is inferred as Object instead of String when the optional parameter t is omitted.
As a workaround, manually adding the type resolves the issue: MyClass<String> myClass = new MyClass<String>(i:3);
However, this results in another IntelliJ error: Cannot resolve constructor 'MyClass($constructor_<Object>)'
