Closed robsimmons closed 12 years ago
This is a variant of the familiar issue of how instantiation relates to subsorting. But, using sort constraints won't work in this case.
And, after thinking about this generally for quite a while, I think I see that there's a natural approach to calculating residual sorts that avoids these issues. I've tried this before and failed - the key new insight is that when calculating the sort "bottom up" we can pass "top down" the original sort from which some patterns have been subtracted. I think this is needed to resolve the cases involving functions - for which we know we can't have partially matched.
I'm half-way through implementing this, so stay tuned. And, I have some similar ideas on how to instantiate variables and constructors in "head position" of a checkable expression - which seems to account for all but one of the <: constraints in the current l10 sml code.
This won't crash anymore, and for the given code it works fine.
But more generally the sorts assigned to variables in patterns could sometimes be accurate. So, I'm also still planning to implement a "try and see" approach to limiting instantiations as well as the improved "bottom up" calculation via upper and lower bounds on sort variables mentioned in my previous comment.
https://github.com/robsimmons/l10/tree/bug4
Causes Crash to be raised. Not a clue.