kotlin-playground-wp-plugin icon indicating copy to clipboard operation
kotlin-playground-wp-plugin copied to clipboard

Line if (index < binaryToSignal.size) { deactivates WP plugin

Open emign opened this issue 5 years ago • 1 comments

Hi, I am playing with the WP plugin at the moment and I stumbled upon the following problem:

I paste this into WP:

object HandshakeCalculator {
 fun calculateHandshake(number: Int): List<Signal> {
     val binaryToSignal = Signal.values().asList()
     val binaryString = number.toString(2)
     var result = mutableListOf<Signal>()

     binaryString.reversed().forEachIndexed { index, item ->
         if (item == '1') {
             if (index < binaryToSignal.size) {
                 result.add(binaryToSignal[index])
             }
         }
     }
     return if (binaryString.reversed().getOrNull(4) == '1') result.reversed() else result
 }
}

and it does not open the playground editor on the corresponding WP site. but just shows the code as regular WP-text.

If you remove the line if (index < binaryToSignal.size) {

everything works as intended

emign avatar Jul 23 '19 19:07 emign

It is actually the < sign. you can test it using:

[kotlin]![/kotlin] // works [kotlin]<[/kotlin] // breaks the editor

emign avatar Jul 23 '19 19:07 emign