summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-05-26 21:53:19 -0700
committerSom Snytt <som.snytt@gmail.com>2016-05-26 21:53:19 -0700
commitfd6386a51e9a5b97a83198a310923cd012e1aab0 (patch)
treeb91f5fdc9fdf65c39aae7cdec3424bc2e44fe5af
parentedbf2c42d933ed59e4f5f41c26bfcc8f18915caf (diff)
downloadscala-fd6386a51e9a5b97a83198a310923cd012e1aab0.tar.gz
scala-fd6386a51e9a5b97a83198a310923cd012e1aab0.tar.bz2
scala-fd6386a51e9a5b97a83198a310923cd012e1aab0.zip
SI-9794 Error advice uses decoded method name
So much work went into polishing this error message, it's worth buffing the method name when it's an operator. The message now says `+` instead of `$plus`.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala2
-rw-r--r--test/files/neg/missing-arg-list.check7
-rw-r--r--test/files/neg/missing-arg-list.scala3
3 files changed, 10 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index 90ccaefe43..d519948a11 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -632,7 +632,7 @@ trait ContextErrors {
//adapt
def MissingArgsForMethodTpeError(tree: Tree, meth: Symbol) = {
- val f = meth.name
+ val f = meth.name.decoded
val paf = s"$f(${ meth.asMethod.paramLists map (_ map (_ => "_") mkString ",") mkString ")(" })"
val advice = s"""
|Unapplied methods are only converted to functions when a function type is expected.
diff --git a/test/files/neg/missing-arg-list.check b/test/files/neg/missing-arg-list.check
index 5a011c36f2..229baac177 100644
--- a/test/files/neg/missing-arg-list.check
+++ b/test/files/neg/missing-arg-list.check
@@ -18,4 +18,9 @@ Unapplied methods are only converted to functions when a function type is expect
You can make this conversion explicit by writing `h _` or `h(_,_,_)(_)` instead of `h`.
val z = h
^
-four errors found
+missing-arg-list.scala:15: error: missing argument list for method + in trait T
+Unapplied methods are only converted to functions when a function type is expected.
+You can make this conversion explicit by writing `+ _` or `+(_)` instead of `+`.
+ val p = +
+ ^
+5 errors found
diff --git a/test/files/neg/missing-arg-list.scala b/test/files/neg/missing-arg-list.scala
index c422dd32fe..44b83e429d 100644
--- a/test/files/neg/missing-arg-list.scala
+++ b/test/files/neg/missing-arg-list.scala
@@ -10,4 +10,7 @@ trait T {
val x = f
val y = g
val z = h
+
+ def +(i: Int) = i + 42
+ val p = +
}