@@ -221,15 +221,20 @@ private ExecutionError unmatchedFunctionError(String kind, UnmatchedLookupExcept
221221 boolean onlyStatic ) {
222222 String error = ((e .matches () > 1 ) ? "ambiguous." : "no.such." ) + kind ;
223223 Iterable <? extends Function > candidates = IterUtil .empty ();
224+ boolean noMatch = false ;
224225 if (e instanceof UnmatchedFunctionLookupException ) {
225226 candidates = ((UnmatchedFunctionLookupException ) e ).candidates ();
227+ if (IterUtil .isEmpty (candidates )) { noMatch = true ; }
226228 }
227229 else if (e instanceof AmbiguousFunctionLookupException ) {
228230 candidates = ((AmbiguousFunctionLookupException ) e ).candidates ();
229231 }
230- if (!IterUtil .isEmpty (targs )) { error += ".poly" ; }
231- if (expected .isSome ()) { error += ".expected" ; }
232- if (!IterUtil .isEmpty (candidates )) { error += ".candidates" ; }
232+ if (error .equals ("no.such.method" ) && noMatch ) { error += ".name" ; }
233+ else {
234+ if (!IterUtil .isEmpty (targs )) { error += ".poly" ; }
235+ if (expected .isSome ()) { error += ".expected" ; }
236+ if (!IterUtil .isEmpty (candidates )) { error += ".candidates" ; }
237+ }
233238 String typeS = (onlyStatic ? "static " : "" ) + ts .userRepresentation (type );
234239 String expectedS = expected .isSome () ? ts .userRepresentation (expected .unwrap ()) : "" ;
235240 String candidatesS ;
@@ -238,30 +243,14 @@ else if (e instanceof AmbiguousFunctionLookupException) {
238243 }
239244 else {
240245 String prefix = "\n " ;
241- candidatesS = IterUtil .toString (IterUtil .map (candidates , SIGNATURE_STRING ), prefix , "," + prefix , "" );
246+ candidatesS = IterUtil .toString (IterUtil .map (candidates , SIGNATURE_STRING ), prefix , prefix , "" );
242247 }
243248 setErrorStrings (node , typeS , name , ts .userRepresentation (targs ), nodeTypesString (args ), expectedS , candidatesS );
244249 throw new ExecutionError (error , node );
245250 }
246251
247252 private final Lambda <Function , String > SIGNATURE_STRING = new Lambda <Function , String >() {
248- public String value (Function f ) {
249- StringBuilder result = new StringBuilder ();
250- if (!IterUtil .isEmpty (f .typeParameters ())) {
251- result .append ("<" );
252- result .append (ts .userRepresentation (f .typeParameters ()));
253- result .append ("> " );
254- }
255- if (!(f instanceof DJConstructor )) {
256- result .append (ts .userRepresentation (f .returnType ()));
257- result .append (" " );
258- }
259- result .append (f .declaredName ());
260- result .append ("(" );
261- result .append (ts .userRepresentation (SymbolUtil .parameterTypes (f )));
262- result .append (")" );
263- return result .toString ();
264- }
253+ public String value (Function f ) { return ts .userRepresentation (f ); }
265254 };
266255
267256 /** Verify that the given symbol is accessible. */
0 commit comments