Fix generic overrides conflicts. (#1293)

This commit is contained in:
Nikolay Igotti
2018-02-08 16:15:28 +03:00
committed by GitHub
parent c455064ca2
commit 98a7f9cdec
@@ -154,15 +154,17 @@ private val FunctionDescriptor.signature: String
typeToHashString(it.type) typeToHashString(it.type)
}.joinToString(";") }.joinToString(";")
// Just distinguish value types and references - it's needed for calling virtual methods through bridges. // Distinguish value types and references - it's needed for calling virtual methods through bridges.
val returnTypePart = // Also is function has type arguments - frontend allows exactly matching overrides.
val signatureSuffix =
when { when {
this.typeParameters.isNotEmpty() -> "Generic"
returnType.let { it != null && it.isValueType() } -> "ValueType" returnType.let { it != null && it.isValueType() } -> "ValueType"
returnType.let { it != null && !KotlinBuiltIns.isUnitOrNullableUnit(it) } -> "Reference" returnType.let { it != null && !KotlinBuiltIns.isUnitOrNullableUnit(it) } -> "Reference"
else -> "" else -> ""
} }
return "$extensionReceiverPart($argsPart)$returnTypePart" return "$extensionReceiverPart($argsPart)$signatureSuffix"
} }
// TODO: rename to indicate that it has signature included // TODO: rename to indicate that it has signature included