Disallow orphan constraints on existential parameters
rachitnigam opened this issue · comments
Existential parameters allow constraints on them using where
clauses. However, there are no constraints on how they can be defined:
comp Foo[W]() -> () with {
exists O where W == 10
} where O > 10 { ... }
The two constraints in this component are bad news:
- The constraint on
W
defined withO
acts as an assumption for the calling component which will allow it to do whatever it wants. - The constraint
O > 10
cannot be satisfied by the calling component because the parameter is defined by the component.
We should disallow such orphan constraints by enforcing:
- Constraints on existential parameters must mention the parameter that they are attached to.
- The outer
where
clause cannot mention existential parameters.