[FIR] Fix false-positive INAPPLICABLE_LATEINIT_MODIFIER for property with unresolved type
^KT-51624 Fixed
This commit is contained in:
+6
@@ -19406,6 +19406,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NoInapplicableLateinitModifierForPropertyWithUnnresolvedType.kt")
|
||||
public void testNoInapplicableLateinitModifierForPropertyWithUnnresolvedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/lateinit/NoInapplicableLateinitModifierForPropertyWithUnnresolvedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("setter.kt")
|
||||
public void testSetter() throws Exception {
|
||||
|
||||
+6
@@ -19406,6 +19406,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NoInapplicableLateinitModifierForPropertyWithUnnresolvedType.kt")
|
||||
public void testNoInapplicableLateinitModifierForPropertyWithUnnresolvedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/lateinit/NoInapplicableLateinitModifierForPropertyWithUnnresolvedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("setter.kt")
|
||||
public void testSetter() throws Exception {
|
||||
|
||||
+6
@@ -19406,6 +19406,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NoInapplicableLateinitModifierForPropertyWithUnnresolvedType.kt")
|
||||
public void testNoInapplicableLateinitModifierForPropertyWithUnnresolvedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/lateinit/NoInapplicableLateinitModifierForPropertyWithUnnresolvedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("setter.kt")
|
||||
public void testSetter() throws Exception {
|
||||
|
||||
+2
-5
@@ -15,14 +15,11 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyGetter
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertySetter
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.hasExplicitBackingField
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.isLateInit
|
||||
import org.jetbrains.kotlin.fir.types.ConeTypeParameterType
|
||||
import org.jetbrains.kotlin.fir.types.coneType
|
||||
import org.jetbrains.kotlin.fir.types.isNullable
|
||||
import org.jetbrains.kotlin.fir.types.isPrimitiveOrNullablePrimitive
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
|
||||
object FirInapplicableLateinitChecker : FirPropertyChecker() {
|
||||
override fun check(declaration: FirProperty, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (!declaration.isLateInit) {
|
||||
if (!declaration.isLateInit || declaration.returnTypeRef is FirErrorTypeRef) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-51624
|
||||
|
||||
lateinit var x: <!UNRESOLVED_REFERENCE!>UnresolvedType<!>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public lateinit var x: [Error type: Unresolved type for UnresolvedType]
|
||||
|
||||
Generated
+6
@@ -19412,6 +19412,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NoInapplicableLateinitModifierForPropertyWithUnnresolvedType.kt")
|
||||
public void testNoInapplicableLateinitModifierForPropertyWithUnnresolvedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/lateinit/NoInapplicableLateinitModifierForPropertyWithUnnresolvedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("setter.kt")
|
||||
public void testSetter() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user