summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2015-02-19 10:25:59 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-02-19 10:25:59 -0800
commita3a794fc3ba7128342310517da43e1ec143f85bd (patch)
tree74c9b733f0eb21723460c684a39cc0031b757f32 /src
parent2d26cacd24b396c7f7449e731f059811d0d1fac4 (diff)
parent9cd5c881fc13acbd9aca08fd6ae2830292e5f1b4 (diff)
downloadscala-a3a794fc3ba7128342310517da43e1ec143f85bd.tar.gz
scala-a3a794fc3ba7128342310517da43e1ec143f85bd.tar.bz2
scala-a3a794fc3ba7128342310517da43e1ec143f85bd.zip
Merge pull request #4340 from retronym/topic/infix-completion
SI-9153 More complete and stable results for completions
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala6
-rw-r--r--src/interactive/scala/tools/nsc/interactive/ContextTrees.scala6
-rw-r--r--src/interactive/scala/tools/nsc/interactive/Global.scala3
-rw-r--r--src/reflect/scala/reflect/internal/StdNames.scala1
-rw-r--r--src/reflect/scala/reflect/internal/util/Collections.scala3
5 files changed, 13 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 71558273a6..d3cd26f256 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -609,7 +609,7 @@ trait Implicits {
val itree2 = if (!isView) fallback else pt match {
case Function1(arg1, arg2) =>
typed1(
- atPos(itree0.pos)(Apply(itree1, List(Ident("<argument>") setType approximate(arg1)))),
+ atPos(itree0.pos)(Apply(itree1, List(Ident(nme.argument) setType approximate(arg1)))),
EXPRmode,
approximate(arg2)
) match {
@@ -918,7 +918,7 @@ trait Implicits {
/** Returns all eligible ImplicitInfos and their SearchResults in a map.
*/
- def findAll() = mapFrom(eligible)(typedImplicit(_, ptChecked = false, isLocalToCallsite))
+ def findAll() = linkedMapFrom(eligible)(typedImplicit(_, ptChecked = false, isLocalToCallsite))
/** Returns the SearchResult of the best match.
*/
@@ -963,7 +963,7 @@ trait Implicits {
* symbols of the same name in succeeding lists.
* @return map from infos to search results
*/
- def applicableInfos(iss: Infoss, isLocalToCallsite: Boolean): Map[ImplicitInfo, SearchResult] = {
+ def applicableInfos(iss: Infoss, isLocalToCallsite: Boolean): mutable.LinkedHashMap[ImplicitInfo, SearchResult] = {
val start = if (Statistics.canEnable) Statistics.startCounter(subtypeAppInfos) else null
val computation = new ImplicitComputation(iss, isLocalToCallsite) { }
val applicable = computation.findAll()
diff --git a/src/interactive/scala/tools/nsc/interactive/ContextTrees.scala b/src/interactive/scala/tools/nsc/interactive/ContextTrees.scala
index bf718c27cc..a4cb3efa4f 100644
--- a/src/interactive/scala/tools/nsc/interactive/ContextTrees.scala
+++ b/src/interactive/scala/tools/nsc/interactive/ContextTrees.scala
@@ -55,7 +55,11 @@ trait ContextTrees { self: Global =>
context
}
}
- locateContextTree(contexts, pos) map locateFinestContextTree map (_.context)
+ def sanitizeContext(c: Context): Context = {
+ c.retyping = false
+ c
+ }
+ locateContextTree(contexts, pos) map locateFinestContextTree map (ct => sanitizeContext(ct.context))
}
/** Returns the ContextTree containing `pos`, or the ContextTree positioned just before `pos`,
diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala
index a3d0346f81..2d09435f60 100644
--- a/src/interactive/scala/tools/nsc/interactive/Global.scala
+++ b/src/interactive/scala/tools/nsc/interactive/Global.scala
@@ -1084,7 +1084,6 @@ 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
@@ -1139,7 +1138,7 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
for (view <- applicableViews) {
val vtree = viewApply(view)
val vpre = stabilizedType(vtree)
- for (sym <- vtree.tpe.members) {
+ for (sym <- vtree.tpe.members if sym.isTerm) {
addTypeMember(sym, vpre, inherited = false, view.tree.symbol)
}
}
diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala
index f32b7326fe..c0562b0679 100644
--- a/src/reflect/scala/reflect/internal/StdNames.scala
+++ b/src/reflect/scala/reflect/internal/StdNames.scala
@@ -1078,6 +1078,7 @@ trait StdNames {
val reflPolyCacheName: NameType = "reflPoly$Cache"
val reflParamsCacheName: NameType = "reflParams$Cache"
val reflMethodName: NameType = "reflMethod$Method"
+ val argument: NameType = "<argument>"
}
diff --git a/src/reflect/scala/reflect/internal/util/Collections.scala b/src/reflect/scala/reflect/internal/util/Collections.scala
index d128521be8..a743d8962a 100644
--- a/src/reflect/scala/reflect/internal/util/Collections.scala
+++ b/src/reflect/scala/reflect/internal/util/Collections.scala
@@ -181,6 +181,9 @@ trait Collections {
final def mapFrom[A, A1 >: A, B](xs: List[A])(f: A => B): Map[A1, B] = {
Map[A1, B](xs map (x => (x, f(x))): _*)
}
+ final def linkedMapFrom[A, A1 >: A, B](xs: List[A])(f: A => B): mutable.LinkedHashMap[A1, B] = {
+ mutable.LinkedHashMap[A1, B](xs map (x => (x, f(x))): _*)
+ }
final def mapWithIndex[A, B](xs: List[A])(f: (A, Int) => B): List[B] = {
val lb = new ListBuffer[B]