From eb5b5511149f9fe8a34b4fe40aa0c6962b5d84da Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Thu, 8 Nov 2012 19:53:15 +0400 Subject: [PATCH] 'moreSpecific' fix if both functions are generic, no need to check receiver and parameters before recursive call with substituted bounds --- .../results/OverloadingConflictResolver.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/results/OverloadingConflictResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/results/OverloadingConflictResolver.java index 06790e4f607..7d09940a153 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/results/OverloadingConflictResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/results/OverloadingConflictResolver.java @@ -97,7 +97,18 @@ public class OverloadingConflictResolver { } } - if (discriminateGenericDescriptors && !isGeneric(f) && isGeneric(g)) return true; + boolean isGenericF = isGeneric(f); + boolean isGenericG = isGeneric(g); + if (discriminateGenericDescriptors) { + if (!isGenericF && isGenericG) return true; + if (isGenericF && !isGenericG) return false; + + if (isGenericF && isGenericG) { + return moreSpecific(DescriptorUtils.substituteBounds(f), DescriptorUtils.substituteBounds(g), false); + } + } + + if (OverridingUtil.overrides(f, g)) return true; if (OverridingUtil.overrides(g, f)) return false; @@ -179,16 +190,6 @@ public class OverloadingConflictResolver { } } - if (discriminateGenericDescriptors && isGeneric(f)) { - if (!isGeneric(g)) { - return false; - } - - // g is generic, too - - return moreSpecific(DescriptorUtils.substituteBounds(f), DescriptorUtils.substituteBounds(g), false); - } - return true; }