Scala: Unable to verify compliance for unreachable

I am transferring an application from game 2.0.4 to play 2.1

But the following code triggers this warning:

def toConditionOperator(value: String): ConditionOperator.Value = { if (value==null) { ConditionOperator.Unknown } else { value.toLowerCase match { case "equal" | "=" | ":" => ConditionOperator.Equal case "notequal" | "!=" | "!:" | "<>" => ConditionOperator.NotEqual case "greaterorequal" | ">=" => ConditionOperator.GreaterOrEqual case "greater" | ">" => ConditionOperator.Greater case "lessorequal" | "<=" => ConditionOperator.LessOrEqual case "less" | "<" => ConditionOperator.Less case "between" => ConditionOperator.Between case "in" => ConditionOperator.In case "startswith" => ConditionOperator.StartsWith case "endswith" => ConditionOperator.EndsWith case "contains" | "$" => ConditionOperator.Contains case "missing" | "" => ConditionOperator.Missing case "unknown" | _ => ConditionOperator.Unknown } } } [info] Compiling 98 Scala sources and 2 Java sources to /home/sas/tmp/ideas-ba/webservice/target/scala-2.10/classes... [warn] /home/sas/tmp/ideas-ba/webservice/app/utils/query/ConditionParser.scala:203: Cannot check match for unreachability. [warn] (The analysis required more space than allowed. Please try with scalac -Dscalac.patmat.analysisBudget=512 or -Dscalac.patmat.analysisBudget=off.) [warn] value.toLowerCase match { [warn] ^ 

In game 2.0.4 (with scala 2.9.1) it worked fine, with this version (scala 2.10) it gives this warning

Any idea what could be wrong?

+4
source share
4 answers

Is it possible ?

<y> What happens if you add

 scalacOptions ++= Seq("-Dscalac.patmat.analysisBudget=1024") 

to your project/Build.scala ? C>

[UPDATE / CORRECTION]

I was wrong about scalacOptions - -D parameters should be passed as JVM arguments, not scalac arguments. Since sbt / play belongs to the JAVA_OPTS environment, a variable, maybe you can try running play or sbt , like this?

 JAVA_OPTS="-Dscalac.patmat.analysisBudget=off" sbt # Or JAVA_OPTS="-Dscalac.patmat.analysisBudget=off" play 

Suppose you are on a Unix-y OS.

+5
source

Just ran into the same problem (but not on Play). For a more permanent fix, simply create the ~/.sbtconfig and add the following lines:

 #!/bin/sh SBT_OPTS="-Dscalac.patmat.analysisBudget=off" 

This file and SBT_OPTS defined inside it will be used every time sbt starts. Depending on where you got Play, it may be associated with its own version of sbt and may not use this file at startup.

+2
source

For configuration < for each SBT project , add this to your .scala assembly .scala .

 initialize ~= { _ => sys.props("scalac.patmat.analysisBudget") = "off" } 
+1
source

For sbt 0.13. * Adding the -J scalac option to build.sbt works for me:

 scalacOptions ++= Seq("-Jscalac.patmat.analysisBudget=off") 

or

 sbt -J-Dscalac.patmat.analysisBudget=off 

or you can add the option with "-J" to the global options file: / usr / local / etc / sbtopts

0
source

Source: https://habr.com/ru/post/1447216/


All Articles