Fix AssertionError on overloading function with property in actual class

#KT-22352 Fixed
This commit is contained in:
Alexander Udalov
2018-02-05 19:29:41 +01:00
parent 56be83cdd3
commit 22595acbfd
10 changed files with 96 additions and 0 deletions
@@ -161,6 +161,8 @@ object ExpectedActualResolver {
sealed class Incompatible(val reason: String?, val kind: IncompatibilityKind = IncompatibilityKind.WEAK) : Compatibility() {
// Callables
object CallableKind : Incompatible("callable kinds are different (function vs property)", IncompatibilityKind.STRONG)
object ParameterShape : Incompatible("parameter shapes are different (extension vs non-extension)", IncompatibilityKind.STRONG)
object ParameterCount : Incompatible("number of value parameters is different", IncompatibilityKind.STRONG)
@@ -227,6 +229,9 @@ object ExpectedActualResolver {
"This function should be invoked only for declarations in the same kind of container (both members or both top level): $a, $b"
}
if (a is FunctionDescriptor && b !is FunctionDescriptor ||
a !is FunctionDescriptor && b is FunctionDescriptor) return Incompatible.CallableKind
val aExtensionReceiver = a.extensionReceiverParameter
val bExtensionReceiver = b.extensionReceiverParameter
if ((aExtensionReceiver != null) != (bExtensionReceiver != null)) return Incompatible.ParameterShape