| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b4cb953 commit da8b202
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -221,15 +221,20 @@ private ExecutionError unmatchedFunctionError(String kind, UnmatchedLookupExcept | |||
| 221 | 221 | boolean onlyStatic) { | |
| 222 | 222 | String error = ((e.matches() > 1) ? "ambiguous." : "no.such.") + kind; | |
| 223 | 223 | Iterable<? extends Function> candidates = IterUtil.empty(); | |
| 224 | + boolean noMatch = false; | ||
| 224 | 225 | if (e instanceof UnmatchedFunctionLookupException) { | |
| 225 | 226 | candidates = ((UnmatchedFunctionLookupException) e).candidates(); | |
| 227 | + if (IterUtil.isEmpty(candidates)) { noMatch = true; } | ||
| 226 | 228 | } | |
| 227 | 229 | else if (e instanceof AmbiguousFunctionLookupException) { | |
| 228 | 230 | candidates = ((AmbiguousFunctionLookupException) e).candidates(); | |
| 229 | 231 | } | |
| 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 | + } | ||
| 233 | 238 | String typeS = (onlyStatic ? "static " : "") + ts.userRepresentation(type); | |
| 234 | 239 | String expectedS = expected.isSome() ? ts.userRepresentation(expected.unwrap()) : ""; | |
| 235 | 240 | String candidatesS; | |
@@ -238,30 +243,14 @@ else if (e instanceof AmbiguousFunctionLookupException) { | |||
| 238 | 243 | } | |
| 239 | 244 | else { | |
| 240 | 245 | 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, ""); | ||
| 242 | 247 | } | |
| 243 | 248 | setErrorStrings(node, typeS, name, ts.userRepresentation(targs), nodeTypesString(args), expectedS, candidatesS); | |
| 244 | 249 | throw new ExecutionError(error, node); | |
| 245 | 250 | } | |
| 246 | 251 | ||
| 247 | 252 | 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); } | ||
| 265 | 254 | }; | |
| 266 | 255 | ||
| 267 | 256 | /** Verify that the given symbol is accessible. */ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments