[FE 1.0] Don't use identifier in WhenMissingCase.kt if it wasn't provided

^KT-49702 Fixed
This commit is contained in:
Victor Petukhov
2021-11-17 13:50:16 +03:00
parent 42805db989
commit 5c3835ab39
7 changed files with 60 additions and 1 deletions
@@ -32555,6 +32555,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/when/kt48653_before.kt");
}
@Test
@TestMetadata("kt49702.kt")
public void testKt49702() throws Exception {
runTest("compiler/testData/diagnostics/tests/when/kt49702.kt");
}
@Test
@TestMetadata("kt9929.kt")
public void testKt9929() throws Exception {
@@ -32555,6 +32555,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/when/kt48653_before.kt");
}
@Test
@TestMetadata("kt49702.kt")
public void testKt49702() throws Exception {
runTest("compiler/testData/diagnostics/tests/when/kt49702.kt");
}
@Test
@TestMetadata("kt9929.kt")
public void testKt9929() throws Exception {
@@ -32555,6 +32555,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/when/kt48653_before.kt");
}
@Test
@TestMetadata("kt49702.kt")
public void testKt49702() throws Exception {
runTest("compiler/testData/diagnostics/tests/when/kt49702.kt");
}
@Test
@TestMetadata("kt9929.kt")
public void testKt9929() throws Exception {
@@ -45,7 +45,8 @@ sealed class WhenMissingCase {
}
override fun toString(): String {
val name = classId.shortClassName.identifier
val className = classId.shortClassName
val name = if (className.isSpecial) className.asString() else className.identifier
return if (isSingleton) name else "is $name"
}
}
+9
View File
@@ -0,0 +1,9 @@
// FIR_IDENTICAL
sealed class A {
class B:A()
class<!SYNTAX!><!> :A()
fun test(a : A) {
<!NON_EXHAUSTIVE_WHEN_STATEMENT("sealed class/interface; 'is B', 'is <no name provided>' branches or 'else' branch instead")!>when<!>(a) {
}
}
}
+25
View File
@@ -0,0 +1,25 @@
package
public sealed class A {
protected constructor A()
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 final fun test(/*0*/ a: A): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class <no name provided> : A {
public constructor <no name provided>()
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 final override /*1*/ /*fake_override*/ fun test(/*0*/ a: A): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class B : A {
public constructor B()
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 final override /*1*/ /*fake_override*/ fun test(/*0*/ a: A): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -32651,6 +32651,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/when/kt48653_before.kt");
}
@Test
@TestMetadata("kt49702.kt")
public void testKt49702() throws Exception {
runTest("compiler/testData/diagnostics/tests/when/kt49702.kt");
}
@Test
@TestMetadata("kt9929.kt")
public void testKt9929() throws Exception {