diff options
4 files changed, 52 insertions, 2 deletions
diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala index 94f9aef38b..da838e0f83 100644 --- a/src/interactive/scala/tools/nsc/interactive/Global.scala +++ b/src/interactive/scala/tools/nsc/interactive/Global.scala @@ -1056,8 +1056,15 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") case t => t } val context = doLocateContext(pos) + + val shouldTypeQualifier = tree0.tpe match { + case null => true + case mt: MethodType => mt.isImplicit + case _ => false + } + // TODO: guard with try/catch to deal with ill-typed qualifiers. - val tree = if (tree0.tpe eq null) analyzer newTyper context typedQualifier tree0 else tree0 + val tree = if (shouldTypeQualifier) analyzer newTyper context typedQualifier tree0 else tree0 debugLog("typeMembers at "+tree+" "+tree.tpe) val superAccess = tree.isInstanceOf[Super] @@ -1231,4 +1238,3 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") } object CancelException extends Exception - diff --git a/test/files/presentation/completion-implicit-chained.check b/test/files/presentation/completion-implicit-chained.check new file mode 100644 index 0000000000..b34e6bc7e1 --- /dev/null +++ b/test/files/presentation/completion-implicit-chained.check @@ -0,0 +1,29 @@ +reload: Completions.scala + +askTypeCompletion at Completions.scala(11,16) +================================================================================ +[response] askCompletionAt (11,16) +retrieved 24 members +[inaccessible] protected[package lang] def clone(): Object +[inaccessible] protected[package lang] def finalize(): Unit +def equals(x$1: Any): Boolean +def hashCode(): Int +def map(x: Int => Int)(implicit a: DummyImplicit): test.O.type +def toString(): String +final def !=(x$1: Any): Boolean +final def !=(x$1: AnyRef): Boolean +final def ##(): Int +final def ==(x$1: Any): Boolean +final def ==(x$1: AnyRef): Boolean +final def asInstanceOf[T0]: T0 +final def eq(x$1: AnyRef): Boolean +final def isInstanceOf[T0]: Boolean +final def ne(x$1: AnyRef): Boolean +final def notify(): Unit +final def notifyAll(): Unit +final def synchronized[T0](x$1: T0): T0 +final def wait(): Unit +final def wait(x$1: Long): Unit +final def wait(x$1: Long,x$2: Int): Unit +private[this] val prefix123: Int +================================================================================ 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. +} |