Undocumented stub generator syntax causes the stub generator to fail

A stub generator syntax for types, array[T](n), is used in a contribution (https://www.codingame.com/contribute/view/62121aa790767e8a2cdac9d7087f927f30b70). Yet, it is not documented in the contribution guidelines and causes problems for the stub generator in some cases.

The stub generator fails to generate correct code for some languages. For Haskell, the read function is used incorrectly and the type of the variable becomes undefined.

input_line <- getLine
let xs = read input_line :: undefined

The correct code is

input_line <- getLine
let xs = map read (words input_line) :: [T]

For Rust, the stub generator simply fails to generate any code. The correct code is

let mut input_line = String::new();
io::stdin().read_line(&mut input_line).unwrap();
let xs: Vec<T> = input_line
    .split_whitespace()
    .map(|x| parse_input!(x, T))
    .collect();
1 Like