From b8e6291265bdb057c81154c001572e1c8ac67ab5 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 18 Apr 2019 12:25:36 +0300 Subject: [PATCH] Inference: use generic version of error type in type approximator --- .../src/org/jetbrains/kotlin/types/TypeApproximator.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt index d354c39ab56..7f85dc0fb01 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt @@ -117,6 +117,8 @@ abstract class AbstractTypeApproximator(val ctx: TypeSystemInferenceExtensionCon private val referenceApproximateToSuperType = this::approximateSimpleToSuperType private val referenceApproximateToSubType = this::approximateSimpleToSubType + open fun createErrorType(message: String): SimpleTypeMarker = + ErrorUtils.createErrorType(message) // null means that this input type is the result, i.e. input type not contains not-allowed kind of types @@ -393,7 +395,7 @@ abstract class AbstractTypeApproximator(val ctx: TypeSystemInferenceExtensionCon // val arguments = type.arguments if (typeConstructor.parametersCount() != type.argumentsCount()) { return if (conf.errorType) { - ErrorUtils.createErrorType("Inconsistent type: $type (parameters.size = ${typeConstructor.parametersCount()}, arguments.size = ${type.argumentsCount()})") + createErrorType("Inconsistent type: $type (parameters.size = ${typeConstructor.parametersCount()}, arguments.size = ${type.argumentsCount()})") } else type.defaultResult(toSuper) }