Error with `rem` operator


#1

I keep finding an error when trying to replace % with rem. In IDEA:

In Gradle:

[simon@NV55C cg]$ gradle build
:generateGrammarSource UP-TO-DATE
:compileKotlin
w: The '-d' option with a directory destination is ignored because '-module' is specified
e: /home/simon/Code/cg/src/main/kotlin/com/github/simonorono/cg/lib/BitArray.kt: (69, 53): 'infix' modifier is required on 'rem' in 'kotlin.Int'
:compileKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 22.704 secs

Here you can find the whole code. Is this a know bug or should I report it?


#2

You already have an Int – why not just use %?

EDIT: Sorry, didn’t see the part before the code snippet. What I should ask is: why do you want to replace % with rem?


#3

This is a known bug. rem was added in Kotlin 1.1.0, but the suggestion to replace it is incorrectly shown even for projects that use the 1.0.6 runtime. However, we do recommend you to update your runtime to 1.1.0.


#4

It is using the 1.1.0 runtime. Look.


#5

I second this question.

There is no infix modifier on rem operator declaration, why do you expect it can be used in infix form?


#6

I guess I didn’t understand the introduction of rem well enough. Should I leave % and when the IDE bug fix comes the warning will disappear?


#7

Yes, the warning should disappear after the fix.
Btw, what is your project configuration that causes that warning? I’ve cloned your project and didn’t see any warnings regarding deprecated %.


#8

I have IDEA 2016.3.5. IDEA files are being generated by gradle idea. Kotlin plugin version is 1.1.1-release-IJ2016.3-1 and the project was just updated to use 1.1.1. Problem persist.