[nem-en] overloads & inference
Michal Moskal
michal.moskal at gmail.com
Tue Jul 10 10:01:18 CEST 2007
On 6/24/07, Dmitry Ivankov <divanorama at gmail.com> wrote:
> Following breaks inference without user-defined operators:
>
> _ = xx => match (xx) {
> | (a : int, []) => a + 2 //or without :int
> | (a, [x]) => (x + a) + 1
> | (_, _) => 2
> }
>
> Is it expected? Shouldn't "a" from first case give type hint for second
> case?
No, yes.
>
> (x+a) stays unresolved with types ? and int++, while (x+a)+1 is resolved.
> It can't resolve because int++ doesn't have any hint (but it has single
> upper_tyvar), x hasn't any as well.
The hint should propagate in this case. If we have int :> 'a :> 'b,
then we also should have int :> 'b. I'm not quite sure why it doesn't
happen, will try to have a look today.
--
Michał
More information about the devel-en
mailing list