diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeAliasExpander.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeAliasExpander.kt index 5e01e42d82d..1d5308a54f6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeAliasExpander.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeAliasExpander.kt @@ -113,13 +113,15 @@ class TypeAliasExpander( ): TypeProjection { val type = originalProjection.type - if (!type.requiresTypeAliasExpansion()) { + if (type.isError || !type.requiresTypeAliasExpansion()) { return originalProjection } val typeConstructor = type.constructor val typeDescriptor = typeConstructor.declarationDescriptor + assert(typeConstructor.parameters.size == type.arguments.size) { "Unexpected malformed type: $type" } + when (typeDescriptor) { is TypeParameterDescriptor -> { return originalProjection