diff --git a/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala b/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala index fd859158b566..2fc5059ca41d 100644 --- a/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala +++ b/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala @@ -6,6 +6,7 @@ import java.nio.file.{Files, Path} import ast.tpd import ast.tpd.* +import ast.desugar.TrailingForMap import collection.mutable import core.Comments.Comment import core.Flags.* @@ -93,10 +94,24 @@ object LiftCoverage extends LiftImpure: case _ if valueType.existsPart(_.typeSymbol == defn.TypeBox_CAP) => valueType case _ => super.liftedExprType(expr) - def liftForCoverage(defs: mutable.ListBuffer[tpd.Tree], tree: tpd.Apply)(using Context) = - val liftedFun = liftApp(defs, tree.fun) - val liftedArgs = liftArgs(defs, tree.fun.tpe, tree.args)(using liftingArgsContext) - tpd.cpy.Apply(tree)(liftedFun, liftedArgs) + def liftForCoverage( + defs: mutable.ListBuffer[tpd.Tree], + tree: tpd.Apply, + shouldLiftSelectedApply: tpd.Apply => Boolean = _ => false, + coverageCallFor: tpd.Apply => Option[tpd.Apply] = _ => None + )(using Context): tpd.Tree = + def recur(tree: tpd.Apply, instrumentCurrent: Boolean): tpd.Tree = + val liftedFun = tree.fun match + case sel @ tpd.Select(app: tpd.Apply, name) if shouldLiftSelectedApply(app) => + liftApp(defs, tpd.cpy.Select(sel)(recur(app, instrumentCurrent = true), name)) + case _ => + liftApp(defs, tree.fun) + val liftedArgs = liftArgs(defs, tree.fun.tpe, tree.args)(using liftingArgsContext) + val liftedApp = tpd.cpy.Apply(tree)(liftedFun, liftedArgs) + if instrumentCurrent then coverageCallFor(tree).foreach(defs += _) + liftedApp + + recur(tree, instrumentCurrent = false) /** Implements code coverage by inserting calls to scala.runtime.coverage.Invoker * ("instruments" the source code). @@ -350,7 +365,7 @@ class InstrumentCoverage extends MacroTransform with IdentityDenotTransformer: // Also, tree.fun can be lifted too. // See LiftCoverage for the internal working of this lifting. val liftedDefs = mutable.ListBuffer[Tree]() - val liftedApp = LiftCoverage.liftForCoverage(liftedDefs, app) + val liftedApp = LiftCoverage.liftForCoverage(liftedDefs, app, selectedApplyNeedsLift, coverageCallForSelectedApply) InstrumentedParts(liftedDefs.toList, coverageCall, liftedApp) else @@ -728,35 +743,63 @@ class InstrumentCoverage extends MacroTransform with IdentityDenotTransformer: * should not be changed to {val $x = f(); T($x)}(1) but to {val $x = f(); val $y = 1; T($x)($y)} */ private def needsLift(tree: Apply)(using Context): Boolean = - def isShortCircuitedOp(sym: Symbol) = - sym == defn.Boolean_&& || sym == defn.Boolean_|| - - def isUnliftableFun(fun: Tree) = - /* - * We don't want to lift a || getB(), to avoid calling getB if a is true. - * Same idea with a && getB(): if a is false, getB shouldn't be called. - * - * On top of that, the `s`, `f` and `raw` string interpolators are special-cased - * by the compiler and will disappear in phase StringInterpolatorOpt, therefore - * they shouldn't be lifted. - */ - val sym = fun.symbol - sym.exists && ( - isShortCircuitedOp(sym) - || StringInterpolatorOpt.isCompilerIntrinsic(sym) - || sym == defn.Object_synchronized - || isContextFunctionApply(fun) - ) - end isUnliftableFun + def hasSelectedApply(fun: Tree): Boolean = fun match + case Select(app: Apply, _) => selectedApplyNeedsLift(app) + case TypeApply(fn, _) => hasSelectedApply(fn) + case _ => false val fun = tree.fun val nestedApplyNeedsLift = fun match case a: Apply => needsLift(a) case _ => false + nestedApplyNeedsLift || + !isUnliftableFun(fun) + && ( + !tree.hasAttachment(TrailingForMap) && hasSelectedApply(fun) + || !tree.args.isEmpty && !tree.args.forall(LiftCoverage.noLift) + ) + + private def selectedApplyNeedsLift(tree: Apply)(using Context): Boolean = + !LiftCoverage.isUnsafeAssumeSeparate(tree) + && canInstrumentApply(tree) + && needsLiftWithoutSelectedApply(tree) + + private def needsLiftWithoutSelectedApply(tree: Apply)(using Context): Boolean = + val fun = tree.fun + val nestedApplyNeedsLift = fun match + case a: Apply => needsLiftWithoutSelectedApply(a) + case _ => false + nestedApplyNeedsLift || !isUnliftableFun(fun) && !tree.args.isEmpty && !tree.args.forall(LiftCoverage.noLift) + private def isShortCircuitedOp(sym: Symbol)(using Context) = + sym == defn.Boolean_&& || sym == defn.Boolean_|| + + private def isUnliftableFun(fun: Tree)(using Context) = + /* + * We don't want to lift a || getB(), to avoid calling getB if a is true. + * Same idea with a && getB(): if a is false, getB shouldn't be called. + * + * On top of that, the `s`, `f` and `raw` string interpolators are special-cased + * by the compiler and will disappear in phase StringInterpolatorOpt, therefore + * they shouldn't be lifted. + */ + val sym = fun.symbol + sym.exists && ( + isShortCircuitedOp(sym) + || StringInterpolatorOpt.isCompilerIntrinsic(sym) + || sym == defn.Object_synchronized + || isContextFunctionApply(fun) + ) + end isUnliftableFun + + private def coverageCallForSelectedApply(tree: Apply)(using Context): Option[Apply] = + Option.when(!LiftCoverage.isUnsafeAssumeSeparate(tree) && canInstrumentApply(tree))( + createInvokeCall(tree, tree.sourcePos) + ) + private def isContextFunctionApply(fun: Tree)(using Context): Boolean = fun match case Select(prefix, nme.apply) => diff --git a/tests/coverage/pos/Constructor.scoverage.check b/tests/coverage/pos/Constructor.scoverage.check index ed9ac68752bb..a87b404a504c 100644 --- a/tests/coverage/pos/Constructor.scoverage.check +++ b/tests/coverage/pos/Constructor.scoverage.check @@ -92,6 +92,23 @@ covtest C Class covtest.C + +108 +120 +10 +toString +Apply +false +0 +false +x.toString() + +5 +Constructor.scala +covtest +C +Class +covtest.C f 133 138 @@ -103,7 +120,7 @@ false false def f -5 +6 Constructor.scala covtest C @@ -120,7 +137,7 @@ false false 1 -6 +7 Constructor.scala covtest C @@ -137,7 +154,7 @@ false false def x -7 +8 Constructor.scala covtest C @@ -154,7 +171,7 @@ false false f(x) -8 +9 Constructor.scala covtest C @@ -171,7 +188,7 @@ false false x -9 +10 Constructor.scala covtest C @@ -188,7 +205,7 @@ false false 2 -10 +11 Constructor.scala covtest C @@ -205,7 +222,7 @@ false false def g -11 +12 Constructor.scala covtest O @@ -222,7 +239,7 @@ false false def g -12 +13 Constructor.scala covtest O @@ -239,7 +256,7 @@ false false 1 -13 +14 Constructor.scala covtest O @@ -256,7 +273,7 @@ false false def y -14 +15 Constructor.scala covtest O diff --git a/tests/coverage/pos/ContextFunctions.scoverage.check b/tests/coverage/pos/ContextFunctions.scoverage.check index ee5c40b9b1ac..aadf40d494dc 100644 --- a/tests/coverage/pos/ContextFunctions.scoverage.check +++ b/tests/coverage/pos/ContextFunctions.scoverage.check @@ -127,6 +127,23 @@ Imperative Class covtest.Imperative readPerson +252 +295 +14 + +Apply +false +0 +false +OnError((e) => readName2(using e)(using s)) + +7 +ContextFunctions.scala +covtest +Imperative +Class +covtest.Imperative +readPerson 192 206 12 diff --git a/tests/coverage/pos/DefaultArgs.scoverage.check b/tests/coverage/pos/DefaultArgs.scoverage.check index c75f1854a0f8..118d5f8263d9 100644 --- a/tests/coverage/pos/DefaultArgs.scoverage.check +++ b/tests/coverage/pos/DefaultArgs.scoverage.check @@ -399,6 +399,40 @@ DefaultArgs Object covtest.DefaultArgs staticCaller +706 +720 +28 +staticMethod +Apply +false +0 +false +staticMethod() + +23 +DefaultArgs.scala +covtest +DefaultArgs +Object +covtest.DefaultArgs +staticCaller +706 +738 +28 ++ +Apply +false +0 +false +staticMethod() + staticMethod(5) + +24 +DefaultArgs.scala +covtest +DefaultArgs +Object +covtest.DefaultArgs +staticCaller 676 692 27 diff --git a/tests/coverage/pos/Enum.scoverage.check b/tests/coverage/pos/Enum.scoverage.check index 77894c88d4c1..d85197e4df03 100644 --- a/tests/coverage/pos/Enum.scoverage.check +++ b/tests/coverage/pos/Enum.scoverage.check @@ -93,6 +93,23 @@ Planet Class covtest.Planet surfaceGravity +359 +367 +15 +* +Apply +false +0 +false +G * mass + +5 +Enum.scala +covtest +Planet +Class +covtest.Planet +surfaceGravity 338 356 15 @@ -103,7 +120,7 @@ false false def surfaceGravity -5 +6 Enum.scala covtest Planet @@ -120,7 +137,7 @@ false false otherMass * surfaceGravity -6 +7 Enum.scala covtest Planet @@ -137,7 +154,7 @@ false false surfaceGravity -7 +8 Enum.scala covtest Planet @@ -154,7 +171,7 @@ false false def surfaceWeight -8 +9 Enum.scala covtest EnumTypes @@ -171,7 +188,7 @@ false false Planet(3.303e+23, 2.4397e6) -9 +10 Enum.scala covtest EnumTypes @@ -188,7 +205,7 @@ false false Planet(4.869e+24, 6.0518e6) -10 +11 Enum.scala covtest EnumTypes @@ -205,7 +222,7 @@ false false Planet(5.976e+24, 6.37814e6) -11 +12 Enum.scala covtest EnumTypes @@ -222,7 +239,7 @@ false false Planet(6.421e+23, 3.3972e6) -12 +13 Enum.scala covtest EnumTypes @@ -239,7 +256,7 @@ false false Planet(1.9e+27, 7.1492e7) -13 +14 Enum.scala covtest EnumTypes @@ -256,7 +273,7 @@ false false Planet(5.688e+26, 6.0268e7) -14 +15 Enum.scala covtest EnumTypes @@ -273,7 +290,7 @@ false false Planet(8.686e+25, 2.5559e7) -15 +16 Enum.scala covtest EnumTypes @@ -290,7 +307,7 @@ false false Planet(1.024e+26, 2.4746e7) -16 +17 Enum.scala covtest EnumTypes @@ -307,7 +324,7 @@ false false ListEnum.Cons(1, ListEnum.Cons(2, ListEnum.Cons(3, ListEnum.Empty))) -17 +18 Enum.scala covtest EnumTypes @@ -324,7 +341,7 @@ false false 1 -18 +19 Enum.scala covtest EnumTypes @@ -341,7 +358,7 @@ false false ListEnum.Cons(2, ListEnum.Cons(3, ListEnum.Empty)) -19 +20 Enum.scala covtest EnumTypes @@ -358,7 +375,7 @@ false false 2 -20 +21 Enum.scala covtest EnumTypes @@ -375,7 +392,7 @@ false false ListEnum.Cons(3, ListEnum.Empty) -21 +22 Enum.scala covtest EnumTypes @@ -392,7 +409,7 @@ false false 3 -22 +23 Enum.scala covtest EnumTypes @@ -409,7 +426,7 @@ false false println("Example 1: \\n"+emptyList) -23 +24 Enum.scala covtest EnumTypes @@ -426,7 +443,7 @@ false false "Example 1: \\n"+emptyList -24 +25 Enum.scala covtest EnumTypes @@ -443,7 +460,7 @@ false false "Example 1: \\n" -25 +26 Enum.scala covtest EnumTypes @@ -460,7 +477,7 @@ false false println(s"${list}\\n") -26 +27 Enum.scala covtest EnumTypes @@ -477,7 +494,7 @@ false false earthWeight/Planet.Earth.surfaceGravity -27 +28 Enum.scala covtest EnumTypes @@ -494,7 +511,7 @@ false false Planet.Earth.surfaceGravity -28 +29 Enum.scala covtest EnumTypes @@ -511,7 +528,7 @@ false false for p <- Planet.values do\n println(s"Your weight on $p is ${p.surfaceWeight(mass)}") -29 +30 Enum.scala covtest EnumTypes @@ -528,7 +545,7 @@ false false Planet.values -30 +31 Enum.scala covtest EnumTypes @@ -545,7 +562,7 @@ false false println(s"Your weight on $p is ${p.surfaceWeight(mass)}") -31 +32 Enum.scala covtest EnumTypes @@ -562,7 +579,7 @@ false false p.surfaceWeight(mass) -32 +33 Enum.scala covtest EnumTypes @@ -579,7 +596,7 @@ false false def calculateEarthWeightOnPlanets -33 +34 Enum.scala covtest EnumTypes @@ -596,7 +613,7 @@ false false println("Example 2:") -34 +35 Enum.scala covtest EnumTypes @@ -613,7 +630,7 @@ false false calculateEarthWeightOnPlanets(80) -35 +36 Enum.scala covtest EnumTypes diff --git a/tests/coverage/pos/i21695/test.scoverage.check b/tests/coverage/pos/i21695/test.scoverage.check index d9ee3a172e3f..dd9cbdf279f6 100644 --- a/tests/coverage/pos/i21695/test.scoverage.check +++ b/tests/coverage/pos/i21695/test.scoverage.check @@ -59,6 +59,23 @@ A Trait example.A create +94 +111 +8 +addService +Apply +false +0 +false +x1.addService(x2) + +3 +i21695/A.scala +example +A +Trait +example.A +create 69 79 7 diff --git a/tests/coverage/pos/scoverage-samples-implicit-class.scoverage.check b/tests/coverage/pos/scoverage-samples-implicit-class.scoverage.check index 1c349a5de5c8..987d4ad2ec30 100644 --- a/tests/coverage/pos/scoverage-samples-implicit-class.scoverage.check +++ b/tests/coverage/pos/scoverage-samples-implicit-class.scoverage.check @@ -60,6 +60,23 @@ Class org.scoverage.samples.CreditEngine $anonfun 263 +269 +11 +StringOpssssss +Apply +false +0 +false +"if 1" + +3 +scoverage-samples-implicit-class.scala +org.scoverage.samples +CreditEngine +Class +org.scoverage.samples.CreditEngine +$anonfun +263 276 11 ! @@ -69,7 +86,7 @@ true false "if 1" ! "xd" -3 +4 scoverage-samples-implicit-class.scala org.scoverage.samples CreditEngine @@ -86,7 +103,7 @@ false false println("else 1") -4 +5 scoverage-samples-implicit-class.scala org.scoverage.samples CreditEngine @@ -103,7 +120,7 @@ true false println("else 1") -5 +6 scoverage-samples-implicit-class.scala org.scoverage.samples CreditEngine @@ -120,7 +137,7 @@ false false def receive -6 +7 scoverage-samples-implicit-class.scala org.scoverage.samples StringOpssssss @@ -137,7 +154,7 @@ false false println(s + "!" + str) -7 +8 scoverage-samples-implicit-class.scala org.scoverage.samples StringOpssssss @@ -154,7 +171,24 @@ false false s + "!" + str -8 +9 +scoverage-samples-implicit-class.scala +org.scoverage.samples +StringOpssssss +Class +org.scoverage.samples.StringOpssssss +! +160 +167 +5 ++ +Apply +false +0 +false +s + "!" + +10 scoverage-samples-implicit-class.scala org.scoverage.samples StringOpssssss @@ -171,7 +205,7 @@ false false def ! -9 +11 scoverage-samples-implicit-class.scala org.scoverage.samples scoverage-samples-implicit-class$package diff --git a/tests/coverage/run/chained-apply/test.check b/tests/coverage/run/chained-apply/test.check new file mode 100644 index 000000000000..74f682a3b1eb --- /dev/null +++ b/tests/coverage/run/chained-apply/test.check @@ -0,0 +1,13 @@ +foo +addMode +foo +addMode +bar +foo +addMode +argBar +memberAddMode +bar +depFoo +depAddMode +dep.bar diff --git a/tests/coverage/run/chained-apply/test.measurement.check b/tests/coverage/run/chained-apply/test.measurement.check new file mode 100644 index 000000000000..23cf283535f3 --- /dev/null +++ b/tests/coverage/run/chained-apply/test.measurement.check @@ -0,0 +1,33 @@ +32 +20 +8 +6 +7 +19 +13 +12 +22 +23 +21 +3 +2 +25 +27 +26 +11 +9 +10 +28 +1 +0 +24 +30 +16 +14 +15 +31 +18 +17 +29 +5 +4 diff --git a/tests/coverage/run/chained-apply/test.scala b/tests/coverage/run/chained-apply/test.scala new file mode 100644 index 000000000000..33fb86decf4e --- /dev/null +++ b/tests/coverage/run/chained-apply/test.scala @@ -0,0 +1,40 @@ +class C: + def addMode(c: C): C = + println("memberAddMode") + this + + def bar(): C = + println("bar") + this + +class D: + def bar(): this.type = + println("dep.bar") + this + +def foo(): C = + println("foo") + C() + +def bar(): C = + println("argBar") + C() + +def addMode(c: C): C = + println("addMode") + c + +def depFoo(): D = + println("depFoo") + D() + +def depAddMode(d: D): d.type = + println("depAddMode") + d + +@main +def Test: Unit = + addMode(foo()) + addMode(foo()).bar() + addMode(foo()).addMode(bar()).bar() + depAddMode(depFoo()).bar() diff --git a/tests/coverage/run/chained-apply/test.scoverage.check b/tests/coverage/run/chained-apply/test.scoverage.check new file mode 100644 index 000000000000..76abfd93cdf9 --- /dev/null +++ b/tests/coverage/run/chained-apply/test.scoverage.check @@ -0,0 +1,581 @@ +# Coverage data, format version: 3.0 +# Statement data: +# - id +# - source path +# - package name +# - class name +# - class type (Class, Object or Trait) +# - full class name +# - method name +# - start offset +# - end offset +# - line number +# - symbol name +# - tree name +# - is branch +# - invocations count +# - is ignored +# - description (can be multi-line) +# ' ' sign +# ------------------------------------------ +0 +chained-apply/test.scala + +C +Class +.C +addMode +38 +62 +3 +println +Apply +false +0 +false +println("memberAddMode") + +1 +chained-apply/test.scala + +C +Class +.C +addMode +11 +22 +2 +addMode +DefDef +false +0 +false +def addMode + +2 +chained-apply/test.scala + +C +Class +.C +bar +94 +108 +7 +println +Apply +false +0 +false +println("bar") + +3 +chained-apply/test.scala + +C +Class +.C +bar +75 +82 +6 +bar +DefDef +false +0 +false +def bar + +4 +chained-apply/test.scala + +D +Class +.D +bar +157 +175 +12 +println +Apply +false +0 +false +println("dep.bar") + +5 +chained-apply/test.scala + +D +Class +.D +bar +130 +137 +11 +bar +DefDef +false +0 +false +def bar + +6 +chained-apply/test.scala + +test$package +Object +.test$package +foo +203 +217 +16 +println +Apply +false +0 +false +println("foo") + +7 +chained-apply/test.scala + +test$package +Object +.test$package +foo +220 +223 +17 + +Apply +false +0 +false +C() + +8 +chained-apply/test.scala + +test$package +Object +.test$package +foo +186 +193 +15 +foo +DefDef +false +0 +false +def foo + +9 +chained-apply/test.scala + +test$package +Object +.test$package +bar +242 +259 +20 +println +Apply +false +0 +false +println("argBar") + +10 +chained-apply/test.scala + +test$package +Object +.test$package +bar +262 +265 +21 + +Apply +false +0 +false +C() + +11 +chained-apply/test.scala + +test$package +Object +.test$package +bar +225 +232 +19 +bar +DefDef +false +0 +false +def bar + +12 +chained-apply/test.scala + +test$package +Object +.test$package +addMode +292 +310 +24 +println +Apply +false +0 +false +println("addMode") + +13 +chained-apply/test.scala + +test$package +Object +.test$package +addMode +267 +278 +23 +addMode +DefDef +false +0 +false +def addMode + +14 +chained-apply/test.scala + +test$package +Object +.test$package +depFoo +336 +353 +28 +println +Apply +false +0 +false +println("depFoo") + +15 +chained-apply/test.scala + +test$package +Object +.test$package +depFoo +356 +359 +29 + +Apply +false +0 +false +D() + +16 +chained-apply/test.scala + +test$package +Object +.test$package +depFoo +316 +326 +27 +depFoo +DefDef +false +0 +false +def depFoo + +17 +chained-apply/test.scala + +test$package +Object +.test$package +depAddMode +394 +415 +32 +println +Apply +false +0 +false +println("depAddMode") + +18 +chained-apply/test.scala + +test$package +Object +.test$package +depAddMode +361 +375 +31 +depAddMode +DefDef +false +0 +false +def depAddMode + +19 +chained-apply/test.scala + +test$package +Object +.test$package +Test +446 +460 +37 +addMode +Apply +false +0 +false +addMode(foo()) + +20 +chained-apply/test.scala + +test$package +Object +.test$package +Test +454 +459 +37 +foo +Apply +false +0 +false +foo() + +21 +chained-apply/test.scala + +test$package +Object +.test$package +Test +463 +483 +38 +bar +Apply +false +0 +false +addMode(foo()).bar() + +22 +chained-apply/test.scala + +test$package +Object +.test$package +Test +471 +476 +38 +foo +Apply +false +0 +false +foo() + +23 +chained-apply/test.scala + +test$package +Object +.test$package +Test +463 +477 +38 +addMode +Apply +false +0 +false +addMode(foo()) + +24 +chained-apply/test.scala + +test$package +Object +.test$package +Test +486 +521 +39 +bar +Apply +false +0 +false +addMode(foo()).addMode(bar()).bar() + +25 +chained-apply/test.scala + +test$package +Object +.test$package +Test +494 +499 +39 +foo +Apply +false +0 +false +foo() + +26 +chained-apply/test.scala + +test$package +Object +.test$package +Test +509 +514 +39 +bar +Apply +false +0 +false +bar() + +27 +chained-apply/test.scala + +test$package +Object +.test$package +Test +486 +500 +39 +addMode +Apply +false +0 +false +addMode(foo()) + +28 +chained-apply/test.scala + +test$package +Object +.test$package +Test +486 +515 +39 +addMode +Apply +false +0 +false +addMode(foo()).addMode(bar()) + +29 +chained-apply/test.scala + +test$package +Object +.test$package +Test +524 +550 +40 +bar +Apply +false +0 +false +depAddMode(depFoo()).bar() + +30 +chained-apply/test.scala + +test$package +Object +.test$package +Test +535 +543 +40 +depFoo +Apply +false +0 +false +depFoo() + +31 +chained-apply/test.scala + +test$package +Object +.test$package +Test +524 +544 +40 +depAddMode +Apply +false +0 +false +depAddMode(depFoo()) + +32 +chained-apply/test.scala + +test$package +Object +.test$package +Test +421 +435 +36 +Test +DefDef +false +0 +false +@main\ndef Test + diff --git a/tests/coverage/run/currying/test.scoverage.check b/tests/coverage/run/currying/test.scoverage.check index 5d1b4233a226..5150ba4ede9d 100644 --- a/tests/coverage/run/currying/test.scoverage.check +++ b/tests/coverage/run/currying/test.scoverage.check @@ -42,6 +42,23 @@ Test Object .Test f1 +48 +51 +2 ++ +Apply +false +0 +false +a+b + +2 +currying/test.scala + +Test +Object +.Test +f1 15 21 2 @@ -52,7 +69,7 @@ false false def f1 -2 +3 currying/test.scala Test @@ -69,7 +86,24 @@ false false a+b+c -3 +4 +currying/test.scala + +Test +Object +.Test +$anonfun +105 +108 +4 ++ +Apply +false +0 +false +a+b + +5 currying/test.scala Test @@ -86,7 +120,7 @@ false false def f2 -4 +6 currying/test.scala Test @@ -103,7 +137,24 @@ false false a+b+c -5 +7 +currying/test.scala + +Test +Object +.Test +$anonfun +166 +169 +7 ++ +Apply +false +0 +false +a+b + +8 currying/test.scala Test @@ -120,7 +171,7 @@ false false def g1 -6 +9 currying/test.scala Test @@ -137,7 +188,24 @@ false false a+b+c -7 +10 +currying/test.scala + +Test +Object +.Test +g2 +226 +229 +9 ++ +Apply +false +0 +false +a+b + +11 currying/test.scala Test @@ -154,7 +222,7 @@ false false def g2 -8 +12 currying/test.scala Test @@ -171,7 +239,7 @@ false false println(f1(0)(1)(2)) -9 +13 currying/test.scala Test @@ -188,7 +256,7 @@ false false f1(0)(1)(2) -10 +14 currying/test.scala Test @@ -205,7 +273,7 @@ false false println(f2(0)(1)(2)) -11 +15 currying/test.scala Test @@ -222,7 +290,41 @@ false false f2(0)(1)(2) -12 +16 +currying/test.scala + +Test +Object +.Test +main +310 +315 +13 +apply +Apply +false +0 +false +f2(0) + +17 +currying/test.scala + +Test +Object +.Test +main +310 +318 +13 +apply +Apply +false +0 +false +f2(0)(1) + +18 currying/test.scala Test @@ -239,7 +341,7 @@ false false println(g1(using 0)(using 1)(using 2)) -13 +19 currying/test.scala Test @@ -256,7 +358,7 @@ false false g1(using 0)(using 1)(using 2) -14 +20 currying/test.scala Test @@ -273,7 +375,7 @@ false false println(g2(using 0)(using 1)(using 2)) -15 +21 currying/test.scala Test @@ -290,7 +392,7 @@ false false g2(using 0)(using 1)(using 2) -16 +22 currying/test.scala Test diff --git a/tests/coverage/run/lifting/test.scoverage.check b/tests/coverage/run/lifting/test.scoverage.check index f876ba013f46..2df5a0cf6187 100644 --- a/tests/coverage/run/lifting/test.scoverage.check +++ b/tests/coverage/run/lifting/test.scoverage.check @@ -161,6 +161,74 @@ A Class .A msg +104 +116 +6 ++ +Apply +false +0 +false +"string" + a + +9 +lifting/test.scala + +A +Class +.A +msg +104 +122 +6 ++ +Apply +false +0 +false +"string" + a + "." + +10 +lifting/test.scala + +A +Class +.A +msg +104 +126 +6 ++ +Apply +false +0 +false +"string" + a + "." + b + +11 +lifting/test.scala + +A +Class +.A +msg +104 +132 +6 ++ +Apply +false +0 +false +"string" + a + "." + b + "." + +12 +lifting/test.scala + +A +Class +.A +msg 70 77 6 @@ -171,7 +239,7 @@ false false def msg -9 +13 lifting/test.scala A @@ -188,7 +256,7 @@ false false 0 -10 +14 lifting/test.scala A @@ -205,7 +273,7 @@ false false def integer -11 +15 lifting/test.scala A @@ -222,7 +290,7 @@ false false def ex -12 +16 lifting/test.scala test$package @@ -239,7 +307,7 @@ false false A() -13 +17 lifting/test.scala test$package @@ -256,7 +324,7 @@ false false 123 -14 +18 lifting/test.scala test$package @@ -273,7 +341,7 @@ false false -1 -15 +19 lifting/test.scala test$package @@ -290,7 +358,7 @@ false false def f -16 +20 lifting/test.scala test$package @@ -307,7 +375,7 @@ false false a.msg(i, 0, a.integer) -17 +21 lifting/test.scala test$package @@ -324,7 +392,7 @@ false false 0 -18 +22 lifting/test.scala test$package @@ -341,7 +409,7 @@ false false a.integer -19 +23 lifting/test.scala test$package @@ -358,7 +426,7 @@ false false println(x) -20 +24 lifting/test.scala test$package @@ -375,7 +443,7 @@ false false a.ex.msg(i, 0, a.ex.integer) -21 +25 lifting/test.scala test$package @@ -392,7 +460,7 @@ false false 0 -22 +26 lifting/test.scala test$package @@ -409,7 +477,7 @@ false false a.ex -23 +27 lifting/test.scala test$package @@ -426,7 +494,7 @@ false false a.ex.integer -24 +28 lifting/test.scala test$package @@ -443,7 +511,7 @@ false false println(x) -25 +29 lifting/test.scala test$package @@ -460,7 +528,7 @@ false false a.msg(f(), 0, i) -26 +30 lifting/test.scala test$package @@ -477,7 +545,7 @@ false false f() -27 +31 lifting/test.scala test$package @@ -494,7 +562,7 @@ false false 0 -28 +32 lifting/test.scala test$package @@ -511,7 +579,7 @@ false false println(x) -29 +33 lifting/test.scala test$package diff --git a/tests/coverage/run/type-apply/test.measurement.check b/tests/coverage/run/type-apply/test.measurement.check index e199fee6b817..3ea5a577a3a2 100644 --- a/tests/coverage/run/type-apply/test.measurement.check +++ b/tests/coverage/run/type-apply/test.measurement.check @@ -1,7 +1,7 @@ 6 -1 2 3 4 +1 5 0 diff --git a/tests/pos-custom-args/captures/coverage-freshcontext-addmode.scala b/tests/pos-custom-args/captures/coverage-freshcontext-addmode.scala new file mode 100644 index 000000000000..9f2998559ee5 --- /dev/null +++ b/tests/pos-custom-args/captures/coverage-freshcontext-addmode.scala @@ -0,0 +1,3 @@ +class C { def setA(a: Int): this.type = this } +def addMode(c: C): c.type = c +val x = addMode(identity(new C()).setA(???)).setA(???)