Skip to content

Commit 7d5a0b3

Browse files
committed
Merge pull request #5193 from som-snytt/issue/9794
SI-9794 Error advice uses decoded method name
2 parents 6265eb8 + fd6386a commit 7d5a0b3

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ trait ContextErrors {
632632

633633
//adapt
634634
def MissingArgsForMethodTpeError(tree: Tree, meth: Symbol) = {
635-
val f = meth.name
635+
val f = meth.name.decoded
636636
val paf = s"$f(${ meth.asMethod.paramLists map (_ map (_ => "_") mkString ",") mkString ")(" })"
637637
val advice = s"""
638638
|Unapplied methods are only converted to functions when a function type is expected.

test/files/neg/missing-arg-list.check

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ Unapplied methods are only converted to functions when a function type is expect
1818
You can make this conversion explicit by writing `h _` or `h(_,_,_)(_)` instead of `h`.
1919
val z = h
2020
^
21-
four errors found
21+
missing-arg-list.scala:15: error: missing argument list for method + in trait T
22+
Unapplied methods are only converted to functions when a function type is expected.
23+
You can make this conversion explicit by writing `+ _` or `+(_)` instead of `+`.
24+
val p = +
25+
^
26+
5 errors found

test/files/neg/missing-arg-list.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ trait T {
1010
val x = f
1111
val y = g
1212
val z = h
13+
14+
def +(i: Int) = i + 42
15+
val p = +
1316
}

0 commit comments

Comments
 (0)