From 541b9954f58ff01adbb4e1dbfa428f51ddf721cf Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Wed, 8 Jun 2016 17:29:56 +0300 Subject: [PATCH] Minor. Roll back behaviour for FlexibleType.isError. --- .../tests/platformTypes/javaEmptyList.kt | 23 +++++++++++++++++++ .../tests/platformTypes/javaEmptyList.txt | 14 +++++++++++ .../checkers/DiagnosticsTestGenerated.java | 6 +++++ .../org/jetbrains/kotlin/types/KotlinType.kt | 2 +- 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/diagnostics/tests/platformTypes/javaEmptyList.kt create mode 100644 compiler/testData/diagnostics/tests/platformTypes/javaEmptyList.txt diff --git a/compiler/testData/diagnostics/tests/platformTypes/javaEmptyList.kt b/compiler/testData/diagnostics/tests/platformTypes/javaEmptyList.kt new file mode 100644 index 00000000000..33656a3d663 --- /dev/null +++ b/compiler/testData/diagnostics/tests/platformTypes/javaEmptyList.kt @@ -0,0 +1,23 @@ +// !CHECK_TYPE + +// FILE: Collections.java +import java.util.List + +public class Collections { + public static final List emptyList() { +} + +// FILE: 1.kt + +fun bar(): List = null!! + +fun test() { + val f = if (true) { + Collections.emptyList() + } + else { + bar() + } + + checkSubtype>(f) +} diff --git a/compiler/testData/diagnostics/tests/platformTypes/javaEmptyList.txt b/compiler/testData/diagnostics/tests/platformTypes/javaEmptyList.txt new file mode 100644 index 00000000000..9f3291e3731 --- /dev/null +++ b/compiler/testData/diagnostics/tests/platformTypes/javaEmptyList.txt @@ -0,0 +1,14 @@ +package + +public fun bar(): kotlin.collections.List +public fun test(): kotlin.Unit + +public open class Collections { + public constructor Collections() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public final fun emptyList(): kotlin.collections.(Mutable)List! +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index c30cf042433..544e51b5dad 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -12903,6 +12903,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("javaEmptyList.kt") + public void testJavaEmptyList() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/javaEmptyList.kt"); + doTest(fileName); + } + @TestMetadata("methodTypeParameterDefaultBound.kt") public void testMethodTypeParameterDefaultBound() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/methodTypeParameterDefaultBound.kt"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/KotlinType.kt b/core/descriptors/src/org/jetbrains/kotlin/types/KotlinType.kt index 0eb02fce08a..4ca109753c6 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/KotlinType.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/KotlinType.kt @@ -156,7 +156,7 @@ abstract class FlexibleType(val lowerBound: SimpleType, val upperBound: SimpleTy override val arguments: List get() = delegate.arguments override val isMarkedNullable: Boolean get() = delegate.isMarkedNullable override val memberScope: MemberScope get() = delegate.memberScope - override val isError: Boolean get() = false + override val isError: Boolean get() = delegate.isError // todo should be false? override fun toString(): String = DescriptorRenderer.DEBUG_TEXT.renderType(this) }