Frontend: create component functions for properties with error types
Fixes an inconsistency in light classes where we could have different class structure depending on whether the type was resolved
This commit is contained in:
-1
@@ -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)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
data class A(val i: Int, val j: <!UNRESOLVED_REFERENCE!>G<!>)
|
||||
data class B(val i: <!UNRESOLVED_REFERENCE!>G<!>, val j: <!UNRESOLVED_REFERENCE!>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()
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user