summaryrefslogtreecommitdiff
path: root/src/compiler
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 /src/compiler
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 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 84670750d7..49f6cb2373 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -999,7 +999,13 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
val context = doLocateContext(pos)
- if (tree.tpe == null)
+ val shouldTypeQualifier = tree.tpe match {
+ case null => true
+ case mt: MethodType => mt.isImplicit
+ case _ => false
+ }
+
+ if (shouldTypeQualifier)
// TODO: guard with try/catch to deal with ill-typed qualifiers.
tree = analyzer.newTyper(context).typedQualifier(tree)
@@ -1192,4 +1198,3 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
}
object CancelException extends Exception
-