Conjunction constraint


(Anthony Latsis) #1

The conjuncion constraint is mentioned over here, but there doesn't seem to be an API to construct it in ConstraintSystem or Constraint.


(John McCall) #2

I think we just haven't needed a disjunction of conjunctions. What are you doing that it's become important?


(Anthony Latsis) #3

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.


(John McCall) #4

Ah, right. And then you can have CSApply just check whether the operand is actually optional.