Type-check context constants [2/?]: access
Summary:
When type-checking a type constant desugared from a
context constant, read its lower bounds in addition to its upper bound.
(The subtyping logic (constraint-based solver) already works with both bounds.)
The extra expressive power is best demonstrated with a brief example:
```
interface I {
const ctx C super [write_props];
function m()[this::C]: void;
}
function good_caller(I $i)[write_props]: void { $i->m(); }
function bad_caller(I $i)[]: void {} // ERROR: write_props is missing
```
Without the lower (`super`) bounds, this `good_caller` would _not_ type-check,
since the implicit lower bound on dependent type `this::C` is `nothing`;
only a caller with `nothing` (infinite set of capabilities) was previously
allowed to call a context-dependent function such as `I::m`
That _major_ limitation has greatly limited the use of (co)effect polymorphism so far.
Coming up: unban the typechecker-only (not HHVM) parser error that prohibits
any bounds on context constants.
Reviewed By: vsiles
Differential Revision:
D27369568
fbshipit-source-id:
bc0242b33274b12d2a6516ce28493b4394b7dad2