Ask Your Question
0

Bug: List/sort methode

asked Jan 04

Hans van Dodewaard gravatar image Hans van Dodewaard
15 1 2 5

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.

delete close flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered Jan 05

MarkHills gravatar image MarkHills
351 6 10

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.

link delete flag offensive edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]
Also see the Rascal Tutor.

Question tools

Follow
1 follower

subscribe to rss feed

Stats

Asked: Jan 04

Seen: 14 times

Last updated: Jan 05