{"action":"created","issue":{"url":"https://api.github.com/repos/puffnfresh/wartremover/issues/175","labels_url":"https://api.github.com/repos/puffnfresh/wartremover/issues/175/labels{/name}","comments_url":"https://api.github.com/repos/puffnfresh/wartremover/issues/175/comments","events_url":"https://api.github.com/repos/puffnfresh/wartremover/issues/175/events","html_url":"https://github.com/puffnfresh/wartremover/issues/175","id":84132021,"number":175,"title":"surprising errors?","user":{"login":"refried","id":538571,"avatar_url":"https://avatars.githubusercontent.com/u/538571?v=3","gravatar_id":"","url":"https://api.github.com/users/refried","html_url":"https://github.com/refried","followers_url":"https://api.github.com/users/refried/followers","following_url":"https://api.github.com/users/refried/following{/other_user}","gists_url":"https://api.github.com/users/refried/gists{/gist_id}","starred_url":"https://api.github.com/users/refried/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/refried/subscriptions","organizations_url":"https://api.github.com/users/refried/orgs","repos_url":"https://api.github.com/users/refried/repos","events_url":"https://api.github.com/users/refried/events{/privacy}","received_events_url":"https://api.github.com/users/refried/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-06-02T18:05:26Z","updated_at":"2015-10-23T02:17:17Z","closed_at":null,"body":"I'm using `wartremoverErrors ++= Warts.unsafe` and getting some funny results.\r\n\r\nin this function:\r\n```\r\nimport scalaz._\r\nimport scala.math.Ordering\r\n\r\n  /** return the set of maxima according to f */\r\n  def argmaxesBy[F[_]:Foldable,A,B:Ordering](fa: F[A])(f: A => B): Set[A] =\r\n    Foldable[F].foldl[A,(Set[A],Option[B])](fa,(Set(),None)) {\r\n      case (_,None) =>\r\n        a => Set(a) -> Some(f(a))\r\n\r\n      case maxes @ (as, bs @ Some(b0)) =>\r\n        a =>\r\n          val b = f(a)\r\n          fromInt(Ordering[B].compare(b,b0)) match {\r\n            case GT => // a > max\r\n              Set(a) -> Some(b)\r\n            case EQ => // a = max\r\n              (as + a, bs)\r\n            case LT => // a < max\r\n              maxes\r\n          }\r\n    } ._1\r\n```\r\nI get:\r\n```\r\n[error] /Users/arya/code/util/src/main/scala/net/arya/util/foldable.scala:40: asInstanceOf is disabled\r\n[error]       case maxes @ (as, bs @ Some(b0)) =>\r\n[error]                                  ^\r\n[error] /Users/arya/code/util/src/main/scala/net/arya/util/foldable.scala:22: throw is disabled\r\n[error]         val (s2,done) = st(a)(s)\r\n[error]                              ^\r\n[error] /Users/arya/code/util/src/main/scala/net/arya/util/foldable.scala:19: throw is disabled\r\n[error]     Foldable[F].foldl(fa,(s,empty[A0])) {\r\n[error]                                         ^\r\n[error] /Users/arya/code/util/src/main/scala/net/arya/util/foldable.scala:43: throw is disabled\r\n[error]           fromInt(Ordering[B].compare(b,b0)) match {\r\n[error]                  ^\r\n[error] /Users/arya/code/util/src/main/scala/net/arya/util/foldable.scala:36: throw is disabled\r\n[error]     Foldable[F].foldl[A,(Set[A],Option[B])](fa,(Set(),None)) {\r\n[error]                                                              ^\r\n```\r\n\r\nasInstanceOf? throw?\r\n\r\nAnother, self-contained example:\r\n\r\n```\r\n13:57 lpatliclai25f:/tmp/wartremover $ ls\r\nFoo.scala build.sbt project   target\r\n14:03 lpatliclai25f:/tmp/wartremover $ cat Foo.scala \r\nobject Foo extends App {\r\n  def f(o: Option[Int]) = o match {\r\n    case Some(i) => println(i)\r\n    case None => println(\"noooooooo!\")\r\n  }\r\n}\r\n14:03 lpatliclai25f:/tmp/wartremover $ cat build.sbt \r\nwartremoverErrors ++= Warts.unsafe\r\n14:04 lpatliclai25f:/tmp/wartremover $ cat project/build.sbt \r\naddSbtPlugin(\"org.brianmckenna\" % \"sbt-wartremover\" % \"0.13\")\r\n14:04 lpatliclai25f:/tmp/wartremover $ \r\n14:04 lpatliclai25f:/tmp/wartremover $ sbt compile\r\n[info] Loading global plugins from /Users/arya/.sbt/0.13/plugins\r\n[info] Loading project definition from /private/tmp/wartremover/project\r\n[info] Set current project to wartremover (in build file:/private/tmp/wartremover/)\r\n[info] Compiling 1 Scala source to /private/tmp/wartremover/target/scala-2.10/classes...\r\n[error] /private/tmp/wartremover/Foo.scala:2: throw is disabled\r\n[error]   def f(o: Option[Int]) = o match {\r\n[error]                           ^\r\n[error] one error found\r\n[error] (compile:compileIncremental) Compilation failed\r\n[error] Total time: 1 s, completed Jun 2, 2015 2:04:25 PM\r\n14:04 lpatliclai25f:/tmp/wartremover $ \r\n```\r\n\r\nAny ideas?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/puffnfresh/wartremover/issues/comments/150413584","html_url":"https://github.com/puffnfresh/wartremover/issues/175#issuecomment-150413584","issue_url":"https://api.github.com/repos/puffnfresh/wartremover/issues/175","id":150413584,"user":{"login":"refried","id":538571,"avatar_url":"https://avatars.githubusercontent.com/u/538571?v=3","gravatar_id":"","url":"https://api.github.com/users/refried","html_url":"https://github.com/refried","followers_url":"https://api.github.com/users/refried/followers","following_url":"https://api.github.com/users/refried/following{/other_user}","gists_url":"https://api.github.com/users/refried/gists{/gist_id}","starred_url":"https://api.github.com/users/refried/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/refried/subscriptions","organizations_url":"https://api.github.com/users/refried/orgs","repos_url":"https://api.github.com/users/refried/repos","events_url":"https://api.github.com/users/refried/events{/privacy}","received_events_url":"https://api.github.com/users/refried/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T02:17:17Z","updated_at":"2015-10-23T02:17:17Z","body":"I confirmed that both my and @ssanj's examples pass the `WartTestTraverser`, although they fail at compile-time.\r\n\r\n```scala\r\n  test(\"Pattern match does not trigger.\") {\r\n    val result = WartTestTraverser(Throw) {\r\n      def f(o: Option[Int]) = o match {\r\n        case Some(i) => println(i)\r\n        case None => println(\"noooooooo!\")\r\n      }\r\n    }\r\n    assertResult(List.empty, \"result.errors\")(result.errors)\r\n    assertResult(List.empty, \"result.warnings\")(result.warnings)\r\n  }\r\n\r\n  test(\"Destructuring bind does not trigger.\") {\r\n    val result = WartTestTraverser(Throw) {\r\n      val (l, r) = Set(1,2,3,4).partition(_ > 3)\r\n      println(s\"$l, $r\")\r\n    }\r\n    assertResult(List.empty, \"result.errors\")(result.errors)\r\n    assertResult(List.empty, \"result.warnings\")(result.warnings)\r\n  }\r\n```"}}