MeAmAnUsername / pie

Pipelines for Interactive Environments
Apache License 2.0
0 stars 0 forks source link

Comparable does not work with wildcards (and generic parameters?) #127

Open MeAmAnUsername opened 3 years ago

MeAmAnUsername commented 3 years ago

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.

MeAmAnUsername commented 3 years ago

Postponed until #202 is resolved

MeAmAnUsername commented 2 years ago

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.