From 6045a05b833c930dfaf343215ac645f4f32f3e2a Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 6 Nov 2013 14:58:01 +0100 Subject: Fix completion after application with implicit arguments `List(1, 2, 3).map(f).` 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. --- src/compiler/scala/tools/nsc/interactive/Global.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/compiler') 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 - -- cgit v1.2.3