[NI] Fix exception on capturing type with inner typealiased typed

This commit is contained in:
Mikhail Zarechenskiy
2018-06-05 12:16:08 +03:00
parent 4883fbfd23
commit 04c13aeae8
5 changed files with 35 additions and 7 deletions
@@ -46,13 +46,14 @@ interface NewTypeSubstitutor {
if (type is AbbreviatedType) {
val substitutedExpandedType = substitute(type.expandedType, keepAnnotation, runCapturedChecks)
val substitutedAbbreviation = substitute(type.abbreviation, keepAnnotation, runCapturedChecks)
if (substitutedExpandedType is SimpleType? && substitutedAbbreviation is SimpleType?) {
return AbbreviatedType(
substitutedExpandedType ?: type.expandedType,
substitutedAbbreviation ?: type.abbreviation
)
} else {
return substitutedExpandedType
return when {
substitutedExpandedType == null && substitutedAbbreviation == null -> null
substitutedExpandedType is SimpleType? && substitutedAbbreviation is SimpleType? ->
AbbreviatedType(
substitutedExpandedType ?: type.expandedType,
substitutedAbbreviation ?: type.abbreviation
)
else -> substitutedExpandedType
}
}