[FIR] KT-57195: Don't approximate ft when checking override return types
Why does this check even exist? K1 doesn't do it. ^KT-57195 Fixed
This commit is contained in:
committed by
Space Team
parent
b385d787cc
commit
5505fd207e
+12
@@ -657,6 +657,18 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/OverrideFunctionWithParamDefaultValue.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideNotNull_Fail.kt")
|
||||
public void testOverrideNotNull_Fail() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overrideNotNull_Fail.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideNotNull_Ok.kt")
|
||||
public void testOverrideNotNull_Ok() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overrideNotNull_Ok.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("OverridenFunctionAndSpecifiedTypeParameter.kt")
|
||||
public void testOverridenFunctionAndSpecifiedTypeParameter() throws Exception {
|
||||
|
||||
+12
@@ -657,6 +657,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/OverrideFunctionWithParamDefaultValue.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideNotNull_Fail.kt")
|
||||
public void testOverrideNotNull_Fail() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overrideNotNull_Fail.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideNotNull_Ok.kt")
|
||||
public void testOverrideNotNull_Ok() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overrideNotNull_Ok.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("OverridenFunctionAndSpecifiedTypeParameter.kt")
|
||||
public void testOverridenFunctionAndSpecifiedTypeParameter() throws Exception {
|
||||
|
||||
+12
@@ -657,6 +657,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/OverrideFunctionWithParamDefaultValue.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideNotNull_Fail.kt")
|
||||
public void testOverrideNotNull_Fail() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overrideNotNull_Fail.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideNotNull_Ok.kt")
|
||||
public void testOverrideNotNull_Ok() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overrideNotNull_Ok.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("OverridenFunctionAndSpecifiedTypeParameter.kt")
|
||||
public void testOverridenFunctionAndSpecifiedTypeParameter() throws Exception {
|
||||
|
||||
+1
-1
@@ -213,7 +213,7 @@ object FirOverrideChecker : FirClassChecker() {
|
||||
return null
|
||||
}
|
||||
|
||||
val bounds = overriddenSymbols.map { context.returnTypeCalculator.tryCalculateReturnType(it).coneType.upperBoundIfFlexible() }
|
||||
val bounds = overriddenSymbols.map { context.returnTypeCalculator.tryCalculateReturnType(it).coneType }
|
||||
|
||||
for (it in bounds.indices) {
|
||||
val overriddenDeclaration = overriddenSymbols[it]
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-57195
|
||||
|
||||
import java.io.File
|
||||
|
||||
open class AbstractFE1UastTest {
|
||||
open var testDataDir = File("").parentFile
|
||||
}
|
||||
|
||||
class Legacy: AbstractFE1UastTest() {
|
||||
override var testDataDir: File = File("").parentFile // K1: ok, K2: VAR_TYPE_MISMATCH_ON_OVERRIDE
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-57195
|
||||
|
||||
import java.io.File
|
||||
|
||||
open class AbstractFE1UastTest {
|
||||
open var testDataDir = File("").parentFile
|
||||
}
|
||||
|
||||
class Legacy: AbstractFE1UastTest() {
|
||||
override var testDataDir: File? = File("").parentFile // K1 & K2: ok
|
||||
}
|
||||
Generated
+12
@@ -657,6 +657,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/OverrideFunctionWithParamDefaultValue.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideNotNull_Fail.kt")
|
||||
public void testOverrideNotNull_Fail() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overrideNotNull_Fail.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideNotNull_Ok.kt")
|
||||
public void testOverrideNotNull_Ok() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overrideNotNull_Ok.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("OverridenFunctionAndSpecifiedTypeParameter.kt")
|
||||
public void testOverridenFunctionAndSpecifiedTypeParameter() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user