From 6be726854f82fd81c5ad6c5e52f41d82a430552c Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Tue, 13 Jun 2017 05:23:07 +0300 Subject: [PATCH] [NI] Preserve type abbreviation during type substitution --- .../calls/inference/components/NewTypeSubstitutor.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt index 4f4802c1214..2b8a8210d6b 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt @@ -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) }