From 96b012aa48e3d91f8ec6d5221df2f455f278c9e0 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Fri, 26 Jun 2015 21:32:29 -0700 Subject: Improved message for missing argument list Clarifies the language and rules for eta-expansion. A missing argument in a list, as opposed to a missing argument list, results in a different message. The comical expansion in parens does not attempt to show what was already applied, but succeeds in showing at a glance the shape of the method in question. ``` scala> def m(i: Int, j: Int)(x: Int) = ??? m: (i: Int, j: Int)(x: Int)Nothing scala> m :12: error: missing argument list for method m Unapplied methods are only converted to functions when a function type is expected. You can make this conversion explicit by writing `m _` or `m(_,_)(_)` instead of `m`. m ^ ``` The original submission was due to sschaef and the wording due to adriaanm, with a minor tweak. --- test/files/neg/macro-invalidshape.check | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/files/neg/macro-invalidshape.check') diff --git a/test/files/neg/macro-invalidshape.check b/test/files/neg/macro-invalidshape.check index aa694df6d6..5093b87598 100644 --- a/test/files/neg/macro-invalidshape.check +++ b/test/files/neg/macro-invalidshape.check @@ -8,8 +8,9 @@ macro [].[[]] or macro [].[[]] def foo2(x: Any) = macro Impls.foo(null)(null) ^ -Macros_Test_2.scala:4: error: missing arguments for method foo in object Impls; -follow this method with `_' if you want to treat it as a partially applied function +Macros_Test_2.scala:4: error: missing argument list for method foo in object Impls +Unapplied methods are only converted to functions when a function type is expected. +You can make this conversion explicit by writing `foo _` or `foo(_)(_)` instead of `foo`. def foo3(x: Any) = macro {2; Impls.foo} ^ Macros_Test_2.scala:7: error: macro implementation reference has wrong shape. required: -- cgit v1.2.3