diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/OverloadingConflictResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/OverloadingConflictResolver.java index aa0f1c3ad95..2053006ceb2 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/OverloadingConflictResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/OverloadingConflictResolver.java @@ -70,6 +70,7 @@ public class OverloadingConflictResolver { * Int < Short < Byte */ private boolean moreSpecific(Descriptor f, Descriptor g, boolean discriminateGenericDescriptors) { + if (discriminateGenericDescriptors && !isGeneric(f) && isGeneric(g)) return true; if (OverridingUtil.overrides(f, g)) return true; if (OverridingUtil.overrides(g, f)) return false; diff --git a/compiler/testData/checkerWithErrorTypes/quick/GenericFunctionIsLessSpecific.jet b/compiler/testData/checkerWithErrorTypes/quick/GenericFunctionIsLessSpecific.jet new file mode 100644 index 00000000000..308a3cd08c0 --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/GenericFunctionIsLessSpecific.jet @@ -0,0 +1,8 @@ +// A generic funciton is always less specific than a non-generic one +fun foo(t : T) : Unit {} +fun foo(i : Int) : Int = 1 + +fun test() { + foo(1) : Int + foo("s") : Unit +} \ No newline at end of file