From 5f9e569926728e7f591a26729efa7700387aeb22 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 21 Feb 2017 09:28:22 +0100 Subject: Don't inline when errors are detected Inlining is only well-defined if the body to inline does not have any errors. We therefore check for errors before we perform any transformation of trees related to inlining. The error check is global, i.e. we stop on any error not just on errors in the code to be inlined. This is a safe approximation, of course. --- tests/neg/i2006.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/neg/i2006.scala (limited to 'tests/neg') diff --git a/tests/neg/i2006.scala b/tests/neg/i2006.scala new file mode 100644 index 000000000..f1b48b011 --- /dev/null +++ b/tests/neg/i2006.scala @@ -0,0 +1,10 @@ +object Test { + + inline def foo(f: ImplicitFunction1[Int, Int]): AnyRef = f // error + inline def bar(f: ImplicitFunction1[Int, Int]) = f // error + + def main(args: Array[String]) = { + foo(implicit thisTransaction => 43) + bar(implicit thisTransaction => 44) + } +} -- cgit v1.2.3