From 2e8029b127699ecd8ed1f55456faa345bd88c5ee Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Tue, 8 May 2012 16:07:15 +0200 Subject: Fixed positions in named default applications (no hyperlinking in conjunction with implicit arguments). Removed even more code in the presentation compiler testing infrastructure. One less level of indirection, and a top-level object gone! --- test/files/presentation/hyperlinks/Runner.scala | 11 +++++++++ .../hyperlinks/src/NameDefaultTests.scala | 16 +++++++++++++ .../presentation/hyperlinks/src/PatMatTests.scala | 28 ++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 test/files/presentation/hyperlinks/Runner.scala create mode 100644 test/files/presentation/hyperlinks/src/NameDefaultTests.scala create mode 100644 test/files/presentation/hyperlinks/src/PatMatTests.scala (limited to 'test/files/presentation/hyperlinks') diff --git a/test/files/presentation/hyperlinks/Runner.scala b/test/files/presentation/hyperlinks/Runner.scala new file mode 100644 index 0000000000..3d19f2d948 --- /dev/null +++ b/test/files/presentation/hyperlinks/Runner.scala @@ -0,0 +1,11 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest { + override def runTests() { + // make sure typer is done.. the virtual pattern matcher might translate + // some trees and mess up positions. But we'll catch it red handed! + sourceFiles foreach (src => askLoadedTyped(src).get) + super.runTests() + } + +} \ No newline at end of file diff --git a/test/files/presentation/hyperlinks/src/NameDefaultTests.scala b/test/files/presentation/hyperlinks/src/NameDefaultTests.scala new file mode 100644 index 0000000000..b218040fe3 --- /dev/null +++ b/test/files/presentation/hyperlinks/src/NameDefaultTests.scala @@ -0,0 +1,16 @@ + +class NameDefaults { + val someString = "abc" + val someInt = 42 + + def foo(x: String, y: Int)(implicit logger: Int): Int = y + + implicit val l = 42 + + def bar { + println() + val someOtherInt = 10 + + foo(y = someOtherInt/*#*/, x = someString/*#*/) + } +} diff --git a/test/files/presentation/hyperlinks/src/PatMatTests.scala b/test/files/presentation/hyperlinks/src/PatMatTests.scala new file mode 100644 index 0000000000..bbd0f2e7ed --- /dev/null +++ b/test/files/presentation/hyperlinks/src/PatMatTests.scala @@ -0,0 +1,28 @@ +package patmat + +abstract class BaseType + +case class CaseOne(x: Int, y: List[Int]) extends BaseType +case class CaseTwo(str: String) extends BaseType + +class PatMatTests { + + def foo(x: BaseType) { + x match { + case CaseOne/*#*/(10, first :: second :: Nil) => + val tmp = 23 + println(first/*#*/) + println(tmp/*#*/) + + case CaseTwo/*#*/(mystring) => + println(mystring/*#*/) + } + } + + def multipleAssign() { + val (x, y) = ("abc", "def") + + println(x/*#*/, y/*#*/) + } + +} \ No newline at end of file -- cgit v1.2.3