{"action":"opened","issue":{"url":"https://api.github.com/repos/rickynils/scalacheck/issues/232","repository_url":"https://api.github.com/repos/rickynils/scalacheck","labels_url":"https://api.github.com/repos/rickynils/scalacheck/issues/232/labels{/name}","comments_url":"https://api.github.com/repos/rickynils/scalacheck/issues/232/comments","events_url":"https://api.github.com/repos/rickynils/scalacheck/issues/232/events","html_url":"https://github.com/rickynils/scalacheck/issues/232","id":146972943,"number":232,"title":"Stack overflow caused by generator","user":{"login":"dabd","id":167463,"avatar_url":"https://avatars.githubusercontent.com/u/167463?v=3","gravatar_id":"","url":"https://api.github.com/users/dabd","html_url":"https://github.com/dabd","followers_url":"https://api.github.com/users/dabd/followers","following_url":"https://api.github.com/users/dabd/following{/other_user}","gists_url":"https://api.github.com/users/dabd/gists{/gist_id}","starred_url":"https://api.github.com/users/dabd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dabd/subscriptions","organizations_url":"https://api.github.com/users/dabd/orgs","repos_url":"https://api.github.com/users/dabd/repos","events_url":"https://api.github.com/users/dabd/events{/privacy}","received_events_url":"https://api.github.com/users/dabd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-08T16:17:36Z","updated_at":"2016-04-08T16:17:36Z","closed_at":null,"body":"The following generator causes a stack overflow error:\r\n\r\n`def bigDecimalGen(lower: BigDecimal = BigDecimal(0), upper: BigDecimal = BigDecimal(\"999999999999\"), withDecimals: Boolean = true): Gen[BigDecimal] =\r\n  for {\r\n    i <- arbBigInt.arbitrary.retryUntil(x => x >= lower.toBigInt && x <= upper.toBigInt)\r\n    d <- if (withDecimals) Gen.chooseNum(0, 99) else Gen.const(0)\r\n  } yield {\r\n    BigDecimal(s\"$i.$d\").setScale(2)\r\n  }\r\n\r\nval fooGen: Gen[(BigDecimal, BigDecimal, BigDecimal)] = for {\r\n  t <- bigDecimalGen(lower = BigDecimal(80000), upper = BigDecimal(150000), withDecimals = false)\r\n  a <- bigDecimalGen(lower = BigDecimal(8000), upper = BigDecimal(20000), withDecimals = false)\r\n  p <- Gen.frequency(\r\n    (50, bigDecimalGen(withDecimals = false).retryUntil(_ <= t)),\r\n    (50, bigDecimalGen(withDecimals = false).retryUntil(_ > t)))\r\n} yield (p, a, t)\r\n\r\nfooGen.sample`\r\n\r\nwill cause \r\n`java.lang.StackOverflowError\r\n\tat org.scalacheck.Gen$$anon$6.doApply(scratch_34:182)\r\n\tat org.scalacheck.Gen$$anonfun$map$1.apply(scratch_34:45)\r\n\tat org.scalacheck.Gen$$anonfun$map$1.apply(scratch_34:45)\r\n\tat org.scalacheck.Gen$$anon$6.doApply(scratch_34:182)\r\n\tat org.scalacheck.Gen$$anon$2.doApply(scratch_34:74)\r\n\tat org.scalacheck.Gen$$anonfun$sized$1.apply(scratch_34:350)\r\n\tat org.scalacheck.Gen$$anonfun$sized$1.apply(scratch_34:350)\r\n\tat org.scalacheck.Gen$$anon$6.doApply(scratch_34:182)\r\n\tat org.scalacheck.Gen$$anonfun$map$1.apply(scratch_34:45)\r\n\tat org.scalacheck.Gen$$anonfun$map$1.apply(scratch_34:45)\r\n\tat org.scalacheck.Gen$$anon$6.doApply(scratch_34:182)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1.apply(scratch_34:49)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1.apply(scratch_34:48)\r\n\tat org.scalacheck.Gen$$anon$6.doApply(scratch_34:182)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1$$anonfun$apply$1.apply(scratch_34:49)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1$$anonfun$apply$1.apply(scratch_34:49)\r\n\tat org.scalacheck.Gen$R$class.flatMap(scratch_34:171)\r\n\tat org.scalacheck.Gen$R$$anon$4.flatMap(scratch_34:157)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1.apply(scratch_34:49)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1.apply(scratch_34:48)\r\n\tat org.scalacheck.Gen$$anon$6.doApply(scratch_34:182)\r\n\tat org.scalacheck.Gen$$anon$2.doApply(scratch_34:74)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1.apply(scratch_34:49)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1.apply(scratch_34:48)\r\n\tat org.scalacheck.Gen$$anon$6.doApply(scratch_34:182)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1$$anonfun$apply$1.apply(scratch_34:49)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1$$anonfun$apply$1.apply(scratch_34:49)\r\n\tat org.scalacheck.Gen$R$class.flatMap(scratch_34:171)\r\n\tat org.scalacheck.Gen$R$$anon$4.flatMap(scratch_34:157)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1.apply(scratch_34:49)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1.apply(scratch_34:48)\r\n\tat org.scalacheck.Gen$$anon$6.doApply(scratch_34:182)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1$$anonfun$apply$1.apply(scratch_34:49)\r\n\tat org.scalacheck.Gen$$anonfun$flatMap$1$$anonfun$apply$1.apply(scratch_34:49)\r\nOutput exceeds cutoff limit.\r\n`"}}