tenderowls / moorka

ABANDONED
21 stars 5 forks source link

Stack overflow in FSM #88

Open vsuharnikov opened 8 years ago

vsuharnikov commented 8 years ago

We can obtain "-1" by incrementing an int value, proof:

val x = Int.MaxValue
x + Int.MaxValue + 1 // prints "-1"

But if we try to do this via FSM:

import moorka._

def fsm = FSM(0) {
  case -1 ⇒ Dummy
  case x ⇒ Val(x + 1)
}

We will get:

java.lang.StackOverflowError at moorka.rx.bindings.package$.bindingStack(scratch_26.scala:9) at moorka.rx.bindings.Binding$class.withContext(scratch_26.scala:10) at moorka.rx.FSM.withContext(scratch_26.scala:15)

  • Moorka 0.7.1
  • Scala.JS 0.6.10