[NI] Preserve type abbreviation during type substitution

This commit is contained in:
Mikhail Zarechenskiy
2017-06-13 05:23:07 +03:00
parent 76d013a33f
commit 6be726854f
@@ -54,6 +54,18 @@ interface NewTypeSubstitutor {
private fun substitute(type: SimpleType, runCapturedChecks: Boolean): UnwrappedType? {
if (type.isError) return null
if (type is AbbreviatedType) {
val substitutedExpandedType = substitute(type.expandedType, runCapturedChecks)
val substitutedAbbreviation = substitute(type.abbreviation, runCapturedChecks)
if (substitutedExpandedType is SimpleType? && substitutedAbbreviation is SimpleType?) {
return AbbreviatedType(substitutedExpandedType ?: type.expandedType,
substitutedAbbreviation ?: type.abbreviation)
}
else {
return substitutedExpandedType
}
}
if (type.arguments.isNotEmpty()) {
return substituteParametrizedType(type, runCapturedChecks)
}