ta0kira / zeolite

Zeolite is a statically-typed, general-purpose programming language.
Apache License 2.0
18 stars 0 forks source link

Comparison expansion does not work properly when one or both sides has multiple levels of unions or intersections. #105

Closed ta0kira closed 3 years ago

ta0kira commented 3 years ago

Suppose we're checking [A&B][[A&B]|C]. Currently, this will be expanded to A[[A&B]|C] || B[[A&B]|C], neither of which succeed. The flaw seems to be that combinations aren't taken into account.

ta0kira commented 3 years ago

It should be sufficient to expand both sides until an intersection vs. union comparison is reached. This means checking for success if the left and right aggregations overlap even the slightest bit. Everything else is checking for a subset. For the "any" aggregation to work, both sides need to be expanded separately, with the other side left intact.

ta0kira commented 3 years ago

Reopening this because this also needs to be fixed in the reduce implementation. (See TypeInstance::CanConvert.)