KT-6391: Arrays with same erased types counted as cast-compatible now
(cherry picked from commit 9e6f4bf)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
82e69d9587
commit
90e5e561e3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user