Kotlin 'rem' not available as replacement for mod?

For count % 2 I get a warning

Warning: (137, 17) Kotlin: 'mod (Int): Int' is deprecated. Use rem (other) instead

and the Intellij IDE provides automatic correction to count.rem(2) , which I then put as an error due to an unresolved reference to rem .

What am I doing wrong?

+5
source share
1 answer

This is a known bug in the Kotlin IDE plugin.

This is due to the obsolescence of the mod function in Kotlin 1.1, which should be replaced by rem (see Other changes to this blog post ). But the IDE plugin reports incorrectly and offers a quick fix even for earlier versions of Kotlin that did not have rem .

Unitl is fixed, you can either upgrade your project to Kotlin 1.1, or suppress warnings or just ignore them.

+6
source

Source: https://habr.com/ru/post/1265284/


All Articles