7

For count % 2 I get the warning

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

and the Intellij IDE provides for an automated correction to count.rem(2) which I then get flagged as an error due to an unresolved reference to rem.

What am I doing wrong?

Community
  • 1
  • 1
Tina Hildebrandt
  • 1,277
  • 1
  • 11
  • 20

1 Answers1

8

This is a known bug in the Kotlin IDE plugin.

It arises from the deprecation of the mod function in Kotlin 1.1, which should be replaced by rem (see Other changes in this blog post). But the IDE plugin incorrectly reports and suggest the quick fix even for earlier Kotlin versions which didn't have rem.

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

Community
  • 1
  • 1
hotkey
  • 140,743
  • 39
  • 371
  • 326