I just update my Rascal plugin in eclipse(to 0.2.13.201112112047) and now I have a problem with the List.sort method combined with aliases.
Example:
import List;
alias Result1 = tuple[str name, int val, int val2];
alias Result2 = tuple[str name, int val];
bool compResult1(Result1 a, Result1 b) {
return a.val > b.val;
}
bool compResult2(Result2 a, Result2 b) {
return a.val > b.val;
}
public void theTest() {
Result1 r1a = <"r1a", 0, 0 >;
Result1 r1b = <"r1b", 1, 1 >;
Result2 r2a = <"r2a", 0 >;
Result2 r2b = <"r2b", 1 >;
list[Result1] l1 = [r1a, r1b];
list[Result2] l2 = [r2a, r2b];
sort(l1,compResult1);
sort(l2,compResult2);
}
rascal>theTest();
std:///List.rsc:141,30: The called signature: compResult1(Result2, Result2),
does not match the declared signature: compResult1(Result1 a, Result1 b)
It seems to use the first compare method all the time.
This is related to a problem that we recently fixed, but it appears that the current plugin version is a little older than that. So, this should work fine in the next plugin release.
Asked: Jan 04
Seen: 14 times
Last updated: Jan 05
Copyright CWI, 2010-2012. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.