The conjuncion constraint is mentioned over here, but there doesn't seem to be an API to construct it in ConstraintSystem
or Constraint
.
I think we just haven't needed a disjunction of conjunctions. What are you doing that it's become important?
I'm teaching the typechecker to expect an optional sequence in a for-in loop. The current constraints that interest are (sequenceType conv T1) && (T1 conf Sequence)
. To expect an optional sequence as well, I thought of this: (sequenceType conv T1) && (T1 conf Sequence || (T1 == Optional<T2> && T2 conf Sequence))
.
But I've already realized that SequenceType conv T1 && T1 == Optional<T2> && T2 conf Sequence
is sufficient.
Ah, right. And then you can have CSApply
just check whether the operand is actually optional.
1 Like