Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
mcomp on polymorphic variants is a little weak #7707
Original bug ID: 7707
The [mcomp] function doesn't really consider the row variable in polymorphic variants. For example, the following doesn't type check:
because [mcomp] does not notice the incompatibility between:
This is of course safe, since it is conservative to assume that all types are compatible. Still it would be nice if it handled these types more accurately.
At the moment [mcomp] will only consider two polymorphic variants incompatible if one of them is closed and does not contain a tag from the other. This doesn't take account of cases where the row variable is a non-aliasable constructor or a universal variable. Ideally [mcomp] would construct the rows necessary to make the variants compatible and would then compare those rows with the actual rows for compatibility.