[FIR] Source for property delegates should not be null
^KT-60327 fixed Merge-request: KT-MR-13221 Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
This commit is contained in:
+6
@@ -52,6 +52,12 @@ public class Fe10IdeNormalAnalysisSourceModuleCollectDiagnosticsTestGenerated ex
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/declarationErrors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incompleteDelegation.kt")
|
||||
public void testIncompleteDelegation() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/incompleteDelegation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incompleteFor.kt")
|
||||
public void testIncompleteFor() throws Exception {
|
||||
|
||||
+6
@@ -52,6 +52,12 @@ public class FirIdeNormalAnalysisSourceModuleCollectDiagnosticsTestGenerated ext
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/declarationErrors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incompleteDelegation.kt")
|
||||
public void testIncompleteDelegation() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/incompleteDelegation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incompleteFor.kt")
|
||||
public void testIncompleteFor() throws Exception {
|
||||
|
||||
+6
@@ -52,6 +52,12 @@ public class FirStandaloneNormalAnalysisSourceModuleCollectDiagnosticsTestGenera
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/declarationErrors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incompleteDelegation.kt")
|
||||
public void testIncompleteDelegation() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/diagnosticsProvider/diagnostics/incompleteDelegation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incompleteFor.kt")
|
||||
public void testIncompleteFor() throws Exception {
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Diagnostics from elements:
|
||||
for PSI element of type KtParameter at (3,21-28)
|
||||
UNUSED_PARAMETER text ranges: [(53,54)]
|
||||
PSI: KtParameter at (3,21-28)
|
||||
for PSI element of type KtParameter at (3,30-45)
|
||||
UNUSED_PARAMETER text ranges: [(62,63)]
|
||||
PSI: KtParameter at (3,30-45)
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
fun String.getValue(x: Any?, y: KProperty<*>) = ""
|
||||
val x: String by <caret>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
Diagnostics from elements:
|
||||
+6
@@ -201,6 +201,12 @@ public class FirOutOfContentRootLazyBodiesCalculatorTestGenerated extends Abstra
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incompletePropertyWithDelegate.kt")
|
||||
public void testIncompletePropertyWithDelegate() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/incompletePropertyWithDelegate.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initBlockWithDeclarations.kt")
|
||||
public void testInitBlockWithDeclarations() throws Exception {
|
||||
|
||||
+6
@@ -201,6 +201,12 @@ public class FirSourceLazyBodiesCalculatorTestGenerated extends AbstractFirSourc
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incompletePropertyWithDelegate.kt")
|
||||
public void testIncompletePropertyWithDelegate() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/incompletePropertyWithDelegate.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initBlockWithDeclarations.kt")
|
||||
public void testInitBlockWithDeclarations() throws Exception {
|
||||
|
||||
+5
@@ -181,6 +181,11 @@ public class LightTree2FirConverterTestCaseGenerated extends AbstractLightTree2F
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incompletePropertyWithDelegate.kt")
|
||||
public void testIncompletePropertyWithDelegate() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/incompletePropertyWithDelegate.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initBlockWithDeclarations.kt")
|
||||
public void testInitBlockWithDeclarations() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initBlockWithDeclarations.kt");
|
||||
|
||||
@@ -1976,6 +1976,7 @@ open class PsiRawFirBuilder(
|
||||
val delegateBuilder = FirWrappedDelegateExpressionBuilder().apply {
|
||||
val delegateFirExpression = extractDelegateExpression()
|
||||
source = delegateFirExpression.source?.fakeElement(KtFakeSourceElementKind.WrappedDelegate)
|
||||
?: this@toFirProperty.delegate?.toFirSourceElement(KtFakeSourceElementKind.WrappedDelegate)
|
||||
expression = delegateFirExpression
|
||||
}
|
||||
|
||||
@@ -2042,6 +2043,7 @@ open class PsiRawFirBuilder(
|
||||
val delegateBuilder = FirWrappedDelegateExpressionBuilder().apply {
|
||||
val delegateExpression = extractDelegateExpression()
|
||||
source = delegateExpression.source?.fakeElement(KtFakeSourceElementKind.WrappedDelegate)
|
||||
?: this@toFirProperty.delegate?.toFirSourceElement(KtFakeSourceElementKind.WrappedDelegate)
|
||||
expression = delegateExpression
|
||||
}
|
||||
|
||||
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
fun String.getValue(x: Any?, y: KProperty<*>) = ""
|
||||
val x: String by
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
FILE: incompletePropertyWithDelegate.kt
|
||||
public? final? fun String.getValue(x: Any?, y: KProperty<*>): <implicit> { LAZY_BLOCK }
|
||||
public? final? val x: Stringby LAZY_EXPRESSION
|
||||
public? get(): <implicit> { LAZY_BLOCK }
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
FILE: incompletePropertyWithDelegate.kt
|
||||
public? final? fun String.getValue(x: Any?, y: KProperty<*>): <implicit> {
|
||||
^getValue String()
|
||||
}
|
||||
public? final? val x: Stringby ERROR_EXPR(Should have delegate)
|
||||
public? get(): <implicit> {
|
||||
^ D|/x|.getValue#(Null(null), ::R|/x|)
|
||||
}
|
||||
+5
@@ -181,6 +181,11 @@ public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuil
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incompletePropertyWithDelegate.kt")
|
||||
public void testIncompletePropertyWithDelegate() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/incompletePropertyWithDelegate.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initBlockWithDeclarations.kt")
|
||||
public void testInitBlockWithDeclarations() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initBlockWithDeclarations.kt");
|
||||
|
||||
+5
@@ -181,6 +181,11 @@ public class RawFirBuilderTestCaseGenerated extends AbstractRawFirBuilderTestCas
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incompletePropertyWithDelegate.kt")
|
||||
public void testIncompletePropertyWithDelegate() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/incompletePropertyWithDelegate.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initBlockWithDeclarations.kt")
|
||||
public void testInitBlockWithDeclarations() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initBlockWithDeclarations.kt");
|
||||
|
||||
Reference in New Issue
Block a user