MeAmAnUsername / pie

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

Least upper bound nullable relies on subtyping #289

Closed MeAmAnUsername closed 2 years ago

MeAmAnUsername commented 2 years ago

Summary Least upper bound returns top type for a nullable type NullableType(T1_inner) and a non-nullable type T2 if T2 is not a subtype of T1_inner, even if there is a more specific bound.

Todo

Description Example code

data Fruit = foreign java Fruit {}
data Orange <: Fruit = foreign java Orange {}
data Banana <: Fruit = foreign java Banana {}

func lub_nullable(orange: Orange, banana: Banana) -> unit = {
  val x = [orange, banana?]
  ; unit
}

Expected: type of x is Fruit?* Actual: type of x is TOP*