summaryrefslogtreecommitdiff
path: root/test/files/presentation
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-11-06 14:58:01 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-11-06 17:25:27 +0100
commit6045a05b833c930dfaf343215ac645f4f32f3e2a (patch)
tree097330f2df5dbb987868df080443e4d759640da9 /test/files/presentation
parent05681d4def04f290728e673b7856a57b872c8019 (diff)
downloadscala-6045a05b833c930dfaf343215ac645f4f32f3e2a.tar.gz
scala-6045a05b833c930dfaf343215ac645f4f32f3e2a.tar.bz2
scala-6045a05b833c930dfaf343215ac645f4f32f3e2a.zip
Fix completion after application with implicit arguments
`List(1, 2, 3).map(f).<ctrl-space>` now works; before the tree had the type `(bf: CanBuildFrom[...]):...` and did not contribute completions from the result type. This commit checks if the tree has an implicit method type, and typechecks it as a qualifier. That is enough to get to `adaptToImplicitMethod` in the type checker, infer the implicit arguments, and compute the final result type accordingly.
Diffstat (limited to 'test/files/presentation')
-rw-r--r--test/files/presentation/completion-implicit-chained.check29
-rw-r--r--test/files/presentation/completion-implicit-chained/Test.scala3
-rw-r--r--test/files/presentation/completion-implicit-chained/src/Completions.scala12
3 files changed, 44 insertions, 0 deletions
diff --git a/test/files/presentation/completion-implicit-chained.check b/test/files/presentation/completion-implicit-chained.check
new file mode 100644
index 0000000000..6d30a61cf9
--- /dev/null
+++ b/test/files/presentation/completion-implicit-chained.check
@@ -0,0 +1,29 @@
+reload: Completions.scala
+
+askTypeCompletion at Completions.scala(11,16)
+================================================================================
+[response] aksTypeCompletion at (11,16)
+retrieved 24 members
+[accessible: true] `method !=(x$1: Any)Boolean`
+[accessible: true] `method !=(x$1: AnyRef)Boolean`
+[accessible: true] `method ##()Int`
+[accessible: true] `method ==(x$1: Any)Boolean`
+[accessible: true] `method ==(x$1: AnyRef)Boolean`
+[accessible: true] `method asInstanceOf[T0]=> T0`
+[accessible: true] `method eq(x$1: AnyRef)Boolean`
+[accessible: true] `method equals(x$1: Any)Boolean`
+[accessible: true] `method hashCode()Int`
+[accessible: true] `method isInstanceOf[T0]=> Boolean`
+[accessible: true] `method map(x: Int => Int)(implicit a: DummyImplicit)test.O.type`
+[accessible: true] `method ne(x$1: AnyRef)Boolean`
+[accessible: true] `method notify()Unit`
+[accessible: true] `method notifyAll()Unit`
+[accessible: true] `method synchronized[T0](x$1: T0)T0`
+[accessible: true] `method toString()String`
+[accessible: true] `method wait()Unit`
+[accessible: true] `method wait(x$1: Long)Unit`
+[accessible: true] `method wait(x$1: Long, x$2: Int)Unit`
+[accessible: true] `value prefix123Int`
+[accessible: false] `method clone()Object`
+[accessible: false] `method finalize()Unit`
+================================================================================
diff --git a/test/files/presentation/completion-implicit-chained/Test.scala b/test/files/presentation/completion-implicit-chained/Test.scala
new file mode 100644
index 0000000000..bec1131c4c
--- /dev/null
+++ b/test/files/presentation/completion-implicit-chained/Test.scala
@@ -0,0 +1,3 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest \ No newline at end of file
diff --git a/test/files/presentation/completion-implicit-chained/src/Completions.scala b/test/files/presentation/completion-implicit-chained/src/Completions.scala
new file mode 100644
index 0000000000..67922dfec0
--- /dev/null
+++ b/test/files/presentation/completion-implicit-chained/src/Completions.scala
@@ -0,0 +1,12 @@
+package test
+
+import scala.Predef.DummyImplicit // turn off other predef implicits for a cleaner .check file.
+
+object O {
+ def map(x: Int => Int)(implicit a: DummyImplicit): O.type = this
+ val prefix123 : Int = 0
+}
+
+class Foo {
+ O.map(x => x)./*!*/ // we want the presentation compiler to apply the implicit argument list.
+}