[Aldor-l] Strange Error Message
Christian Aistleitner
tmgisi at gmx.at
Sat Jan 27 09:33:48 EST 2007
Hello Ralf,
On Sat, 27 Jan 2007 00:33:11 +0100, Ralf Hemmecke <ralf at hemmecke.de> wrote:
> Can somebody from the Aldor developers explain how I should understand
> the following error message and what I should do about it.
>
> "tcdistpoly.as", line 50: assertEquals(T, t1/t2, t2*t1);
> ..........................^
> [L50 C27] #1 (Error) No one possible return type satisfies the context
> type.
> These possible return types were rejected:
> -- SparseIndexedPowerProduct(MachineInteger, MachineInteger)
> The following could be suitable if imported:
> /: (SparseIndexedPowerProduct(MachineInteger, MachineInteger),
> SparseIndexedPowerProduct(MachineInteger, MachineInteger)) ->
> SparseIndexedPowerProduct(MachineInteger, MachineInteger) from
> SparseIndexedPowerProduct(MachineInteger, MachineInteger), if
> SparseIndexedPowerProduct(MachineInteger, MachineInteger) has with /:
> (%, %) -> %
>
> [...]
>
> What can I do? Please help.
once again, the Aldor compiler is not smart enough to resolve the
conditional exports correctly. The problematic thing is the export of the
/ function.
As I do not think the Aldor people will give a fix in reasonable time, I
would suggest to tell Aldor again that T has a function /. For me, the
following piece of code worked (note that I changed t2*t1 to t2/t1 as I do
not know what conditions you pose on multiplication):
assertTrue( T has with { /: (%, %) -> %; } );
if T has with {/: (%, %) -> %;} then {
assertEquals(T, (t1/t2)@T, (t2/t1)@T);
} else {
never;
}
Abstracting the above piece of code into a macro leaves you with a clean,
smooth and maintainable test case.
Kind regards,
Christian
More information about the Aldor-l
mailing list