From 957bbe291d46b32a5e3071fb5021b583f394d33b Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Mon, 27 Nov 2017 17:24:21 +0300 Subject: [PATCH] [NI] Don't approximate error types Previously, we did approximation of error types to Any?/Nothing in some contexts (e.g. non-local declarations). There are several reasons why it is not desired: - OI doesn't approximate ErrorType - This behaviour is inconsistent with ourselves (i.e. sometimes we *do* infer errortype for top-level declaration) - It causes different digressions from OI in reported diagnostics This commit turns off error type approximation. It causes large testdata shift, which is deliberately split into several parts and commited in a separate commits. --- .../src/org/jetbrains/kotlin/types/TypeApproximator.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt index e16c903f300..9e73e627277 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt @@ -67,6 +67,7 @@ open class TypeApproximatorConfiguration { abstract class AbstractCapturedTypesApproximation(val approximatedCapturedStatus: CaptureStatus): TypeApproximatorConfiguration.AllFlexibleSameValue() { override val allFlexible get() = true + override val errorType get() = true // i.e. will be approximated only approximatedCapturedStatus captured types override val capturedType get() = { it: NewCapturedType -> it.captureStatus != approximatedCapturedStatus }