[FIR] Fix "Expected some types" exception, ^KT-51274 Fixed
This commit is contained in:
+6
@@ -10292,6 +10292,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/exceptions"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt")
|
||||
public void testExpectedSomeTypesOnBranchForWhenExpressionOfErroneousType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt24158.kt")
|
||||
public void testKt24158() throws Exception {
|
||||
|
||||
+6
@@ -10292,6 +10292,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/exceptions"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt")
|
||||
public void testExpectedSomeTypesOnBranchForWhenExpressionOfErroneousType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt24158.kt")
|
||||
public void testKt24158() throws Exception {
|
||||
|
||||
+6
@@ -10292,6 +10292,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/exceptions"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt")
|
||||
public void testExpectedSomeTypesOnBranchForWhenExpressionOfErroneousType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt24158.kt")
|
||||
public void testKt24158() throws Exception {
|
||||
|
||||
@@ -102,9 +102,11 @@ object ConeTypeIntersector {
|
||||
val iterator = filteredTypes.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
val upper = iterator.next()
|
||||
val shouldFilter = filteredTypes.any { lower -> lower !== upper && predicate(lower, upper) }
|
||||
|
||||
if (shouldFilter) iterator.remove()
|
||||
if (filteredTypes.any { lower -> lower !== upper && predicate(lower, upper) } ||
|
||||
upper is ConeErrorType && filteredTypes.size > 1
|
||||
) {
|
||||
iterator.remove()
|
||||
}
|
||||
}
|
||||
return filteredTypes
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// ISSUE: KT-51274
|
||||
|
||||
fun test() {
|
||||
val x = <!UNRESOLVED_REFERENCE!>unresolved<!>()
|
||||
val y = when (x) {
|
||||
is String -> x
|
||||
else -> throw Exception()
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// ISSUE: KT-51274
|
||||
|
||||
fun test() {
|
||||
val x = <!UNRESOLVED_REFERENCE!>unresolved<!>()
|
||||
val y = when (<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!>) {
|
||||
is String -> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!>
|
||||
else -> throw Exception()
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
Generated
+6
@@ -10298,6 +10298,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/exceptions"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt")
|
||||
public void testExpectedSomeTypesOnBranchForWhenExpressionOfErroneousType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt24158.kt")
|
||||
public void testKt24158() throws Exception {
|
||||
|
||||
@@ -184,8 +184,8 @@ fun case_13(x: <!UNRESOLVED_REFERENCE!>otherpackage.Case13<!>?) =
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean")!>if ((x == null !is Boolean) !== true) {
|
||||
throw Exception()
|
||||
} else {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ERROR CLASS: Symbol not found for otherpackage.Case13? & kotlin.Boolean & ERROR CLASS: Symbol not found for otherpackage.Case13?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ERROR CLASS: Symbol not found for otherpackage.Case13? & kotlin.Boolean & ERROR CLASS: Symbol not found for otherpackage.Case13?")!>x<!>.equals(x)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ERROR CLASS: Symbol not found for otherpackage.Case13? & kotlin.Boolean")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ERROR CLASS: Symbol not found for otherpackage.Case13? & kotlin.Boolean")!>x<!>.equals(x)
|
||||
}<!>
|
||||
|
||||
// TESTCASE NUMBER: 14
|
||||
@@ -196,6 +196,7 @@ class Case14 {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNREACHABLE_CODE")
|
||||
fun case_14() {
|
||||
val a = Case14()
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ class Case14 {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNREACHABLE_CODE")
|
||||
fun case_14() {
|
||||
val a = Case14()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user