diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt index 308a31b0699..3a618bfca7d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt @@ -163,7 +163,6 @@ open class LazyClassMemberScope( var componentIndex = 0 for (parameter in constructor.valueParameters) { - if (parameter.type.isError) continue if (!primaryConstructorParameters.get(parameter.index).hasValOrVar()) continue val properties = getContributedVariables(parameter.name, location) diff --git a/compiler/testData/diagnostics/tests/dataClasses/errorTypesInDataClasses.kt b/compiler/testData/diagnostics/tests/dataClasses/errorTypesInDataClasses.kt new file mode 100644 index 00000000000..cb61d356996 --- /dev/null +++ b/compiler/testData/diagnostics/tests/dataClasses/errorTypesInDataClasses.kt @@ -0,0 +1,16 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE +data class A(val i: Int, val j: G) +data class B(val i: G, val j: G) + + +fun fa(a: A) { + val (i, j) = a + val i2 = a.component1() + val j2 = a.component2() +} + +fun fb(b: B) { + val (i, j) = b + val i2 = b.component1() + val j2 = b.component2() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/dataClasses/errorTypesInDataClasses.txt b/compiler/testData/diagnostics/tests/dataClasses/errorTypesInDataClasses.txt new file mode 100644 index 00000000000..1eb87de9343 --- /dev/null +++ b/compiler/testData/diagnostics/tests/dataClasses/errorTypesInDataClasses.txt @@ -0,0 +1,28 @@ +package + +public fun fa(/*0*/ a: A): kotlin.Unit +public fun fb(/*0*/ b: B): kotlin.Unit + +public final data class A { + public constructor A(/*0*/ i: kotlin.Int, /*1*/ j: [ERROR : G]) + public final val i: kotlin.Int + public final val j: [ERROR : G] + public final operator /*synthesized*/ fun component1(): kotlin.Int + public final operator /*synthesized*/ fun component2(): [ERROR : G] + public final /*synthesized*/ fun copy(/*0*/ i: kotlin.Int = ..., /*1*/ j: [ERROR : G] = ...): A + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} + +public final data class B { + public constructor B(/*0*/ i: [ERROR : G], /*1*/ j: [ERROR : G]) + public final val i: [ERROR : G] + public final val j: [ERROR : G] + public final operator /*synthesized*/ fun component1(): [ERROR : G] + public final operator /*synthesized*/ fun component2(): [ERROR : G] + public final /*synthesized*/ fun copy(/*0*/ i: [ERROR : G] = ..., /*1*/ j: [ERROR : G] = ...): B + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 50998042cb3..4f038bf3b0f 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -4573,6 +4573,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("errorTypesInDataClasses.kt") + public void testErrorTypesInDataClasses() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dataClasses/errorTypesInDataClasses.kt"); + doTest(fileName); + } + @TestMetadata("extensionComponentsOnNullable.kt") public void testExtensionComponentsOnNullable() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dataClasses/extensionComponentsOnNullable.kt");