From 6becefe90690ae025308b00e0fd7e46646b4f961 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 31 Mar 2015 20:02:28 +0200 Subject: SI-9139 don't inline across @strictfp modes Cannot inline if one of the methods is @strictfp, but not the other. --- .../nsc/backend/jvm/opt/InlineWarningTest.scala | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/junit') diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala index 5b47475863..029caa995c 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala @@ -170,4 +170,25 @@ class InlineWarningTest extends ClearAfterClass { compile(code, allowMessage = i => { c += 1; i.msg contains warn }) assert(c == 1, c) } + + @Test + def cannotMixStrictfp(): Unit = { + val code = + """import annotation.strictfp + |class C { + | @strictfp @inline final def f = 0 + | @strictfp def t1 = f + | def t2 = f + |} + """.stripMargin + + val warn = + """C::f()I is annotated @inline but could not be inlined: + |The callsite method C::t2()I + |does not have the same strictfp mode as the callee C::f()I.""".stripMargin + + var c = 0 + compile(code, allowMessage = i => { c += 1; i.msg contains warn }) + assert(c == 1, c) + } } -- cgit v1.2.3