Closed AshleyYakeley closed 8 months ago
Per AS sec. 5.3.1, substitution works like this:
a <: T
=> [(rec b, a & [b/a-]T)/a-]
T <: a
=> [(rec b, a | [b/a+]T)/a+]
By hand:
m: ((a -> b) & a) -> b
i: c -> c
c -> c <: (a -> b) & a
---
c -> c <: a -> b
c -> c <: a
---
c <: b
a <: c
c -> c <: a
---
c <: b
c -> c <: c
---
[c'/c+](c -> c) = c -> c'
subst = [(rec c', c|(c -> c'))/c+]
rec c', c|(c -> c') <: b
See #206
Fixed.
Consider:
What is the type of
mi
?rec a, Any -> a
(same asrec a, b -> a
).('b ∨ ('b -> 'a)) as 'a
, i.e.,rec a, b | b -> a
.These types are not identical. Pinafore gives a strictly more specific type, but it may not be correct.