Skip to content

Commit 1154886

Browse files
committed
Fix problems found in original fix to scoverage#193
Changes: - revert two changes in `plugin.scala` file (see comment scoverage#193 (comment)) - upgrade Scala version from 2.12.0 to 2.12.1
1 parent 715d76b commit 1154886

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ matrix:
1010
- jdk: oraclejdk7
1111
scala: 2.11.8
1212
- jdk: oraclejdk8
13-
scala: 2.12.0
13+
scala: 2.12.1
1414

1515
before_cache:
1616
- find "$HOME/.sbt/" -name '*.lock' -print0 | xargs -0 rm

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ val ScalatestVersion = "3.0.0"
1212

1313
val appSettings = Seq(
1414
organization := Org,
15-
scalaVersion := "2.12.0",
16-
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.0"),
15+
scalaVersion := "2.12.1",
16+
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.1"),
1717
fork in Test := false,
1818
publishMavenStyle := true,
1919
publishArtifact in Test := false,

scalac-scoverage-plugin/src/main/scala/scoverage/plugin.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,9 +581,6 @@ class ScoverageInstrumentationComponent(val global: Global, extraAfterPhase: Opt
581581

582582
case _: TypeTree => super.transform(tree)
583583

584-
// if the rhs of a val is a literal we can just leave it
585-
case v: ValDef if v.rhs.isInstanceOf[Literal] => tree
586-
587584
/**
588585
* We can ignore lazy val defs as they are implemented by a generated defdef
589586
*/
@@ -602,6 +599,7 @@ class ScoverageInstrumentationComponent(val global: Global, extraAfterPhase: Opt
602599

603600
// we need to remove the final mod so that we keep the code in order to check its invoked
604601
case v: ValDef if v.mods.isFinal =>
602+
updateLocation(v)
605603
treeCopy.ValDef(v, v.mods.&~(ModifierFlags.FINAL), v.name, v.tpt, process(v.rhs))
606604

607605
/**

scalac-scoverage-plugin/src/test/scala/scoverage/PluginCoverageTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PluginCoverageTest
2323
// we expect:
2424
// instrumenting the default-param which becomes a method call invocation
2525
// the method makeGreeting is entered.
26-
compiler.assertNMeasuredStatements(1)
26+
compiler.assertNMeasuredStatements(2)
2727
}
2828

2929
test("scoverage should skip macros") {
@@ -68,7 +68,7 @@ class PluginCoverageTest
6868
|} """.stripMargin)
6969
assert(!compiler.reporter.hasErrors)
7070
// we should have 3 statements - initialising the val, executing println, and executing the parameter
71-
compiler.assertNMeasuredStatements(7)
71+
compiler.assertNMeasuredStatements(8)
7272
}
7373

7474
test("scoverage should not instrument the match as a statement") {

0 commit comments

Comments
 (0)