Compilation/Execution problem with recursive function (polymorphic?) in JSLIGO
Given the following contract named contract.jsligo
:
let recursion : ( xs : list<_a>) => option<_a> =
(xs : list<_a>) : option<_a> => {
return recursion(xs);
};
export let main = ([parameter, storage] : [list<string>, int]) : [list<operation>, int] => {
let _ = recursion(parameter);
return [list([]) as list<operation>, storage]
}
and the given test fragment:
#import "contract.jsligo" "Contract"
let _ = Test.originate(Contract.main, 0, 0 as tez);
The test execution fails with the following message:
➤ ~/bin/ligo run test test.jsligo
An internal error ocurred. Please, contact the developers.
Corner case: recursion not found in env.
Note: This problem does not exist if I remove the polymorphic type replacing _a
by string
for instance.