When I write this instance (yes I know it's incomplete):

instance[t with Addgrp[t]] Addgrp[t*t] {
    fun zero() => zero[t](), zero[t]();
}


Felix gives this error:

UNRESOLVED RETURN ERROR
In complex.flx: line 55, cols 2 to 36
54: instance[t with Addgrp[t]] Addgrp[t*t] {
55:     fun zero() => zero[t](), zero[t]();
     ***********************************
56: }

[typeofindex'] function zero<5469>: Can't resolve return type, got : <T5469>
Possibly each returned expression depends on the return type
Try adding an explicit return type annotation


Okay, let's try this:

instance[t with Addgrp[t]] Addgrp[t*t] {
    fun zero(): t*t => zero[t](), zero[t]();
}


Now we get:

CLIENT ERROR
In return ((zero[t] ()), (zero[t] ()));
Wrong return type,
expected : <T5467> * <T5467>
but we got (<T5467> * <T5467>)^2
In complex.flx: line 55, cols 2 to 41
54: instance[t with Addgrp[t]] Addgrp[t*t] {
55:     fun zero(): t*t => zero[t](), zero[t]();
     ****************************************
56: }


This makes no sense... wouldn't the return type be just <T5467> * <T5467>?

Curiously, this compiles:

instance[t with Addgrp[t]] Addgrp[t*t] {
    fun zero(): t => zero[t](), zero[t]();
}

What's going on here?  Am I missing something critical?

Thanks,
Chris

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to