From 363bad3de9a570746927b3fd9dd0d076cade7750 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Sun, 14 Feb 2016 11:01:37 +0100 Subject: SD-79 don't issue spurious inliner warnings under l:project When enabling `-Yopt:inline-project` (or `-Yopt:l:project`), the inliner would spuriously warn about callsites to methods marked `@inline` that are read from the classpath (not being compiled currently). This patch introduces yet another field to the `Callsite` class, which is growing a bit too large. But the call graph representation will get an overhaul when implementing the new inliner heuristics (2.12.0-M5), so this is just a temporary fix that would be nice to have in M4. --- test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/junit') diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala index 70f3060027..54eddc868d 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala @@ -1515,4 +1515,13 @@ class InlinerTest extends ClearAfterClass { "C$$$anonfun$2", IRETURN, -1 /*A*/, "C$$$anonfun$3", IRETURN)) } + + @Test + def inlineProject(): Unit = { + val codeA = "final class A { @inline def f = 1 }" + val codeB = "class B { def t(a: A) = a.f }" + // tests that no warning is emitted + val List(a, b) = compileClassesSeparately(List(codeA, codeB), extraArgs = "-Yopt:l:project -Yopt-warnings") + assertInvoke(getSingleMethod(b, "t"), "A", "f") + } } -- cgit v1.2.3