Comparable currently does not correctly check if wildcards are comparable.
An example:
data List[T] = foreign java List {}
data Fruit = foreign java Fruit {}
data Apple : Fruit = foreign java Apple {}
data Strawberry : Fruit = foreign java Strawberry {}
func test1(test1: List[_ -: Apple], test2: List[_ -: Strawberry]) -> unit = {
test1 == test2; // todo: should be allowed, both lists could be List[Fruit]
unit
}
There are probably more issues with comparing wildcards and generic parameters.
The problem is that the catchall comparable(T1, T2) :- orB(isAssignableTo(T1, T2), isAssignableTo(T2, T1)) == TRUE(). does not work for this case. I'm not sure exactly what the logic is for checking if two types are comparable.
Updated example in issue description to new generics syntax (#208) and add data type declarations to make it a full example. Also tested it, it's still broken.
Comparable currently does not correctly check if wildcards are comparable. An example:
There are probably more issues with comparing wildcards and generic parameters. The problem is that the catchall
comparable(T1, T2) :- orB(isAssignableTo(T1, T2), isAssignableTo(T2, T1)) == TRUE().
does not work for this case. I'm not sure exactly what the logic is for checking if two types are comparable.