It seems like the Kotlin Language Assist for the web IDE is not consistent with the version of Kotlin that’s actually used for running the code. As an example, if you use List.maxBy
, the language assist shows the method as deprecated and suggests using maxByOrNull
instead, but then when running the code it complains that that method does not exist. It seems like the Language Assist is assuming Kotlin 1.4, but the version actually installed for running the code is older.
Update: Now it’s getting weirder. maxBy
is still shown as a warning for being deprecated, suggesting using maxByOrNull
, but that’s then shown as an error in the code editor (unknown reference). The runtime, however, now treats using maxBy
as an actual error if the list may be empty and now knows maxByOrNull
(which it did not before, see original post). So now it seems like the runtime is newer then the editor code assist (which in itself is somewhat inconsistent, marking one function as deprecated but not knowing the alternative) and you have to use the maxByOrNull
function and just ignore the error in the online code editor.
We’ve upgraded Kotlin to 1.5.0 (from 1.3.31) using the classic, but much slower, compiler.
We’re in the process of increasing the allowed compilation time (plays in IDE should be failing now). Also we’ll increase the LSP version to 1.4 (1.5 not available)
see https://www.codingame.com/forum/t/languages-update/1574/231
sorry for the temporary inconvenience
By the way: This influences code golf, since solutions using min/maxBy (e.g. for the temperatures problem) now need an extra 6 characters.
this has been fixed. The language assist should use the correct version now.