Position error coming back again

472 views
Skip to first unread message

akara.suc...@gmail.com

unread,
Jun 29, 2016, 1:12:01 PM6/29/16
to Scala code coverage tool
There have been a few instances in past versions of scoverage that error'd out with "Position error". But this latest iteration I found the issue with 1.3.3. Upgrading to 1.3.5 did not help. This did not happen the whole time we were using scoverage with this project, but this PR adding a bit of TypeTag usage (TypeTags were used in this project before) has caused the build/coverage issues.


The message is as follows:

[info] ======= Position error

[info] Enclosing tree [6840] does not include tree [6839]

[info] == Enclosing tree [6840] of type TypeApply at [3772:3778]ServiceRegistryBase.scala

[info] 

[info] [L 101        ] #6840   [3772:3778]     TypeApply  // config 

[info] 

[info] == Enclosed tree [6839] of type Select at [3772:3788]ServiceRegistryBase.scala

[info] 

[info] [L 101        ] #6839   [3772:3788]     Select     // getOption[Boolean

[info] 

[info] 

[info] While validating #7333

[info] [L  17        ] #7333   [597:6498]      PackageDef // unicomplex

[info] 

[info] Children:

[info]   [L  17 P# 7333] #6406   [605:625]       Select     // unicomplex

[info]   [L  19 P# 7333] #6410   [627:658]       Import     // javax.net.ssl.SSLContext

[info]   [L  20 P# 7333] #6414   [659:684]       Import     // akka.actor.Actor._

[info]   [L  21 P# 7333] #6417   [685:727]       Import     // akka.actor.{ActorRef, ActorContext}

[info]   [L  22 P# 7333] #6420   [728:751]       Import     // akka.agent.Agent

[info]   [L  23 P# 7333] #6423   [752:784]       Import     // akka.event.LoggingAdapter

[info]   [L  24 P# 7333] #6427   [785:818]       Import     // com.typesafe.config.Config

[info]   [L  25 P# 7333] #6432   [819:870]       Import     // org.squbs.pipeline.streaming.PipelineSetting

[info]   [L  26 P# 7333] #6437   [871:911]       Import     // org.squbs.unicomplex.ConfigUtil._

[info]   [L  28 P# 7333] #6440   [913:963]       Import     // scala.concurrent.{Future, ExecutionContext}

[info]   [L  29 P# 7333] #6444   [964:1006]      Import     // scala.collection.mutable.ListBuffer

[info]   [L  31 P# 7333] #7142   [1008:5601]     ClassDef   // ServiceRegistryBase[A] {

[info]   [L 156 P# 7333] #7212   [5603:5916]     ModuleDef  // WebContext {

[info]   [L 171 P# 7333] #7229   [5918:6013]     ClassDef   // WebContext {

[info]   [L 175 P# 7333] #7332   [6015:6498]     ClassDef   // ListenerBean[A](listenerRoutes: Map[String, Agent[Seq[(A, ActorWrapper, PipelineSetting)]]]) extends ListenerMXBean {

[info] =======

scala.reflect.internal.Positions$ValidateException: Enclosing tree [6840] does not include tree [6839]

at scala.reflect.internal.Positions$class.positionError$1(Positions.scala:102)

at scala.reflect.internal.Positions$class.validate$1(Positions.scala:124)

at scala.reflect.internal.Positions$class.validate$1(Positions.scala:142)

at scala.reflect.internal.Positions$class.validate$1(Positions.scala:142)

at scala.reflect.internal.Positions$class.validate$1(Positions.scala:142)

at scala.reflect.internal.Positions$class.validate$1(Positions.scala:142)

at scala.reflect.internal.Positions$class.validate$1(Positions.scala:142)

at scala.reflect.internal.Positions$class.validate$1(Positions.scala:142)

at scala.reflect.internal.Positions$class.validate$1(Positions.scala:142)

at scala.reflect.internal.Positions$class.validate$1(Positions.scala:142)

at scala.reflect.internal.Positions$class.validate$1(Positions.scala:142)

at scala.reflect.internal.Positions$class.validate$1(Positions.scala:142)

at scala.reflect.internal.Positions$class.validatePositions(Positions.scala:147)


Please let me know how I can help further.

akara.suc...@gmail.com

unread,
Jul 1, 2016, 9:12:22 PM7/1/16
to Scala code coverage tool, akara.suc...@gmail.com
We found a fix for this issue. Basically the code in the line below is causing the failure:

val localPort = config getOption[Boolean] "local-port-header" collect {

This code compiles and tests fine, but scoverage bails. Changing it as follows allows scoverage to pass:

val localPort = config.getOption[Boolean]("local-port-header") collect {

The getOption is part of an implicit class wrapping config which is the Typesafe config library. This combination of implicit wrapper, type parameter, typetag, and infix notation seems to cause the problem. May be worth mentioning with the filed issue https://github.com/scoverage/sbt-scoverage/issues/156.

Thanks!
-Akara

ta...@abdulradi.com

unread,
Jul 12, 2016, 6:17:29 AM7/12/16
to Scala code coverage tool, akara.suc...@gmail.com
Same error, the workaround helped.

My code is similar, but no implicit wrapper was involved.
myPartialFunction orElse [T, U] {
case other =>
...
}

Seems the error is in postfix notation + type parameters.

edmond...@gmail.com

unread,
Jul 27, 2016, 1:49:45 AM7/27/16
to Scala code coverage tool, akara.suc...@gmail.com, ta...@abdulradi.com
How did you solve it? Did you go around all your lines of codes to find them out?

akara.suc...@gmail.com

unread,
Jul 27, 2016, 10:39:49 PM7/27/16
to Scala code coverage tool, akara.suc...@gmail.com, ta...@abdulradi.com, edmond...@gmail.com
You can get some hint from the error messages. It is not extremely clear, but you know the file and the statement causing the issue. In our case:

[info] == Enclosed tree [6839] of type Select at [3772:3788]ServiceRegistryBase.scala

[info] 

[info] [L 101        ] #6839   [3772:3788]     Select     // getOption[Boolean


This tells me I'm looking at an issue where you find getOption[Boolean] in ServiceRegistryBase.scala. The next step is to see what's weird about that line and try to correct it. In this case infix + type parameter as discussed.

Reply all
Reply to author
Forward
0 new messages