use of org.eclipse.ceylon.langtools.tools.javac.comp.Resolve.MethodResolutionContext.Candidate in project ceylon by eclipse.
the class Resolve method reportVerboseResolutionDiagnostic.
void reportVerboseResolutionDiagnostic(DiagnosticPosition dpos, Name name, Type site, List<Type> argtypes, List<Type> typeargtypes, Symbol bestSoFar) {
boolean success = bestSoFar.kind < Kinds.ERRONEOUS;
if (success && !verboseResolutionMode.contains(VerboseResolutionMode.SUCCESS)) {
return;
} else if (!success && !verboseResolutionMode.contains(VerboseResolutionMode.FAILURE)) {
return;
}
if (bestSoFar.name == names.init && bestSoFar.owner == syms.objectType.tsym && !verboseResolutionMode.contains(VerboseResolutionMode.OBJECT_INIT)) {
// skip diags for Object constructor resolution
return;
} else if (site == syms.predefClass.type && !verboseResolutionMode.contains(VerboseResolutionMode.PREDEF)) {
// skip spurious diags for predef symbols (i.e. operators)
return;
} else if (currentResolutionContext.internalResolution && !verboseResolutionMode.contains(VerboseResolutionMode.INTERNAL)) {
return;
}
int pos = 0;
int mostSpecificPos = -1;
ListBuffer<JCDiagnostic> subDiags = new ListBuffer<>();
for (Candidate c : currentResolutionContext.candidates) {
if (currentResolutionContext.step != c.step || (c.isApplicable() && !verboseResolutionMode.contains(VerboseResolutionMode.APPLICABLE)) || (!c.isApplicable() && !verboseResolutionMode.contains(VerboseResolutionMode.INAPPLICABLE))) {
continue;
} else {
subDiags.append(c.isApplicable() ? getVerboseApplicableCandidateDiag(pos, c.sym, c.mtype) : getVerboseInapplicableCandidateDiag(pos, c.sym, c.details));
if (c.sym == bestSoFar)
mostSpecificPos = pos;
pos++;
}
}
String key = success ? "verbose.resolve.multi" : "verbose.resolve.multi.1";
List<Type> argtypes2 = Type.map(argtypes, deferredAttr.new RecoveryDeferredTypeMap(AttrMode.SPECULATIVE, bestSoFar, currentResolutionContext.step));
JCDiagnostic main = diags.note(log.currentSource(), dpos, key, name, site.tsym, mostSpecificPos, currentResolutionContext.step, methodArguments(argtypes2), methodArguments(typeargtypes));
JCDiagnostic d = new JCDiagnostic.MultilineDiagnostic(main, subDiags.toList());
log.report(d);
}
Aggregations