summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-02-14 11:01:37 +0100
committerLukas Rytz <lukas.rytz@gmail.com>2016-02-15 10:40:23 +0100
commit363bad3de9a570746927b3fd9dd0d076cade7750 (patch)
tree184898c792215b0f34bd25709b1c167f0ae58786 /test
parentc672d6892db662f15ea1a84cdbedf857e2a17b22 (diff)
downloadscala-363bad3de9a570746927b3fd9dd0d076cade7750.tar.gz
scala-363bad3de9a570746927b3fd9dd0d076cade7750.tar.bz2
scala-363bad3de9a570746927b3fd9dd0d076cade7750.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala9
1 files changed, 9 insertions, 0 deletions
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")
+ }
}