KT-6391: Arrays with same erased types counted as cast-compatible now

(cherry picked from commit 9e6f4bf)
This commit is contained in:
Mikhail Glukhikh
2016-07-19 15:02:18 +03:00
committed by Mikhail Glukhikh
parent 82e69d9587
commit 90e5e561e3
3 changed files with 30 additions and 0 deletions
@@ -43,6 +43,13 @@ object CastDiagnosticsUtil {
if (lhsType.constructor == rhsType.constructor) {
if (lhsType.arguments.all { TypeUtils.isTypeParameter(it.type) }) return true
if (rhsType.arguments.all { TypeUtils.isTypeParameter(it.type) }) return true
if (KotlinBuiltIns.isArray(lhsType)) {
val lhsArgument = lhsType.arguments.firstOrNull()
val rhsArgument = rhsType.arguments.firstOrNull()
if (lhsArgument != null && rhsArgument != null && lhsArgument.type.constructor == rhsArgument.type.constructor) {
return true
}
}
}
if (isFinal(lhsType) || isFinal(rhsType)) return false