[FIR] add missed diagnostics for incomplete code

^KT-55053
This commit is contained in:
Anna Kozlova
2023-01-27 12:10:09 +01:00
committed by Space Team
parent 706a8a91f6
commit e54627b309
5 changed files with 25 additions and 1 deletions
@@ -0,0 +1 @@
<expr>val p: String by</expr>
@@ -0,0 +1,9 @@
KT element: KtProperty
FIR element: FirPropertyImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
public final val p: R|kotlin/String|by ERROR_EXPR(Should have delegate)
public get(): R|kotlin/String| {
^ D|/p|.<Unresolved name: getValue>#(Null(null), ::R|/p|)
}
@@ -579,6 +579,12 @@ public class OutOfContentRootGetOrBuildFirTestGenerated extends AbstractOutOfCon
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/invalidCode"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("delegatedProperty.kt")
public void testDelegatedProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/invalidCode/delegatedProperty.kt");
}
@Test
@TestMetadata("javaClassLiteral.kt")
public void testJavaClassLiteral() throws Exception {
@@ -579,6 +579,12 @@ public class SourceGetOrBuildFirTestGenerated extends AbstractSourceGetOrBuildFi
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/invalidCode"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("delegatedProperty.kt")
public void testDelegatedProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/invalidCode/delegatedProperty.kt");
}
@Test
@TestMetadata("javaClassLiteral.kt")
public void testJavaClassLiteral() throws Exception {
@@ -1814,7 +1814,9 @@ open class RawFirBuilder(
buildOrLazyExpression(expression.toFirSourceElement()) {
expression.toFirExpression("Should have delegate")
}
} ?: buildErrorExpression { ConeSimpleDiagnostic("Should have delegate", DiagnosticKind.ExpressionExpected) }
} ?: buildErrorExpression {
diagnostic = ConeSimpleDiagnostic("Should have delegate", DiagnosticKind.ExpressionExpected)
}
val delegateBuilder = FirWrappedDelegateExpressionBuilder().apply {
val delegateExpression = extractDelegateExpression()