I have following test case:
test_different_cursor: BOOLEAN
local
cursor: SET_ITERATION_CURSOR[INTEGER, INTEGER]
sets: ARRAY[SET[INTEGER, INTEGER]]
do
create sets.make_empty
check attached {SET_ITERATION_CURSOR[INTEGER, INTEGER]} d.different_cursor as current_cursor then
cursor := current_cursor
end
from
until
cursor.after
loop
sets.force (cursor.item, sets.count + 1)
cursor.forth
end
end
Here, in loop of from~end, I try to call Array class's force feature, but the compiler keep saying following error for that line:
Error code: VUAR(2)
Type error: non-compatible actual argument in feature call.
What to do: make sure that type of actual argument is compatible with
the type of corresponding formal argument.
Class: MY_TESTS
Feature: test_different_cursor
Called feature: force (v: [like item] G; i: INTEGER_32) from ARRAY
Argument name: v
Argument position: 1
Formal argument type: SET [INTEGER_32, INTEGER_32]
Actual argument type: TUPLE [INTEGER_32, INTEGER_32]
Line: 193
loop
-> sets.force (cursor.item, sets.count + 1)
cursor.forth
In this case, it seems like I need to make SET class which inherits ARRAY class and redefine force feature there. But I am not really sure it's the correct way to fix compile error. Here is what my SET class look like:
class
SET[A, B]
create
make
feature
valueA: A
valueB: B
feature
make (first: A; second: B)
do
valueA := first
valueB := second
end
end
What I have to do in order to fix this?