From 9cd5c881fc13acbd9aca08fd6ae2830292e5f1b4 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 17 Feb 2015 16:02:49 +1000 Subject: Remove incorrect completions: implicits can't add type members The checkfile of the tests added in the last commit offered a type member from `RichInt` in the completions for the type `Int`. However, only term members can be extension methods; type members cannot. --- src/interactive/scala/tools/nsc/interactive/Global.scala | 2 +- test/files/presentation/infix-completion.check | 3 +-- test/files/presentation/infix-completion2.check | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala index e42a0fda0e..2d09435f60 100644 --- a/src/interactive/scala/tools/nsc/interactive/Global.scala +++ b/src/interactive/scala/tools/nsc/interactive/Global.scala @@ -1138,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/test/files/presentation/infix-completion.check b/test/files/presentation/infix-completion.check index 84b5325448..f62dc81d34 100644 --- a/test/files/presentation/infix-completion.check +++ b/test/files/presentation/infix-completion.check @@ -3,7 +3,7 @@ reload: Snippet.scala askTypeCompletion at Snippet.scala(1,34) ================================================================================ [response] askTypeCompletion at (1,34) -retrieved 193 members +retrieved 192 members [inaccessible] protected def integralNum: math.Numeric.DoubleAsIfIntegral.type [inaccessible] protected def num: math.Numeric.DoubleIsFractional.type [inaccessible] protected def ord: math.Ordering.Double.type @@ -190,5 +190,4 @@ override def min(that: Double): Double override def min(that: Long): Long override def signum: Int private[this] val self: Double -type ResultWithoutStep = Range.Partial[Double,scala.collection.immutable.NumericRange[Double]] ================================================================================ diff --git a/test/files/presentation/infix-completion2.check b/test/files/presentation/infix-completion2.check index d61ca5e571..5c69cd84cb 100644 --- a/test/files/presentation/infix-completion2.check +++ b/test/files/presentation/infix-completion2.check @@ -3,7 +3,7 @@ reload: Snippet.scala askTypeCompletion at Snippet.scala(1,34) ================================================================================ [response] askTypeCompletion at (1,34) -retrieved 212 members +retrieved 211 members [inaccessible] protected def integralNum: math.Numeric.DoubleAsIfIntegral.type [inaccessible] protected def num: math.Numeric.DoubleIsFractional.type [inaccessible] protected def ord: math.Ordering.Double.type @@ -208,5 +208,4 @@ override def min(that: Int): Int override def min(that: Long): Long override def signum: Int private[this] val self: Double -type ResultWithoutStep = Range.Partial[Double,scala.collection.immutable.NumericRange[Double]] ================================================================================ -- cgit v1.2.3