Prioritized synthetic and not synthetic functions.
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
|
||||
public class ResolutionTaskHolder<D extends CallableDescriptor, F extends D> {
|
||||
private static final int MIN_PRIORITY = 0;
|
||||
private static final int MAX_PRIORITY = 1;
|
||||
private static final int MAX_PRIORITY = 3;
|
||||
|
||||
private final JetReferenceExpression reference;
|
||||
private final BasicCallResolutionContext basicCallResolutionContext;
|
||||
|
||||
+7
-1
@@ -89,7 +89,7 @@ public class TaskPrioritizer {
|
||||
ResolutionTaskHolder.PriorityProvider<ResolutionCandidate<D>> visibleStrategy = new ResolutionTaskHolder.PriorityProvider<ResolutionCandidate<D>>() {
|
||||
@Override
|
||||
public int getPriority(ResolutionCandidate<D> call) {
|
||||
return isVisible(call) ? 1 : 0;
|
||||
return (isVisible(call) ? 2 : 0) + (isSynthesized(call) ? 1 : 0);
|
||||
}
|
||||
|
||||
private boolean isVisible(ResolutionCandidate<D> call) {
|
||||
@@ -98,6 +98,12 @@ public class TaskPrioritizer {
|
||||
if (ErrorUtils.isError(candidateDescriptor)) return true;
|
||||
return Visibilities.isVisible(candidateDescriptor, context.scope.getContainingDeclaration());
|
||||
}
|
||||
|
||||
private boolean isSynthesized(ResolutionCandidate<D> call) {
|
||||
D descriptor = call.getDescriptor();
|
||||
return descriptor instanceof CallableMemberDescriptor &&
|
||||
((CallableMemberDescriptor) descriptor).getKind() == CallableMemberDescriptor.Kind.SYNTHESIZED;
|
||||
}
|
||||
};
|
||||
|
||||
ResolutionTaskHolder<D, F> result = new ResolutionTaskHolder<D, F>(functionReference, context, visibleStrategy);
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
fun Runnable(f: () -> Unit): Runnable = object : Runnable {
|
||||
public override fun run() {
|
||||
f()
|
||||
}
|
||||
}
|
||||
|
||||
val x = Runnable { }
|
||||
@@ -3174,6 +3174,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
||||
doTest("compiler/testData/diagnostics/tests/overload/OverloadVarAndFunInClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("SyntheticAndNotSynthetic.kt")
|
||||
public void testSyntheticAndNotSynthetic() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/overload/SyntheticAndNotSynthetic.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/override")
|
||||
|
||||
Reference in New Issue
Block a user