You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is related to defaulting: currently if we have Literal K a and both Integral a and Field a we default a to Rational. The error happens because we are also assuming that defaulting would always result in satisfying assumptions and so we don't check for errors after.
There are a few possible solutions:
Don't default in this case. I tried this, and it works but the definition is still accepted, it is just that now it has a constraint that has both Integral and Field on the same variable, so it is still useless.
Default like before, but then check for errors afterwards. Defaulting to incorrect types seems a bit weird, and I am not sure if this might be confusing because we'd get an error like Rational is not Integral when there are no visible rationals around.
Do option (1), and maybe add some machinery to the solver to report and error if it notices incompatible constraints like the above.
I'd say 3 is the "right thing" to do, but is also probably more work than the others. Thoughts? @robdockins@brianhuffman
We can already have situations in type checking where two type constraints contradict each other, right? The common case would be contradictory predicates on numeric types. But now with Integral a and Field a we can have contradictory constraints on value types as well. I suppose we should try to handle both cases in a similar way.
The following definition is incorrectly accepted:
Error constraint should never be generalized over, but some how they are.
The text was updated successfully, but these errors were encountered: