FIR LL API: resolve PSI elements to more specific FIR element
Compound access and implicit delegated constructor are mapped to FIR elements that are way too broad.
This commit is contained in:
committed by
Ilya Kirillov
parent
e8f1af6140
commit
bc95733818
+7
@@ -54,6 +54,13 @@ internal class KtFirExpressionTypeProvider(
|
||||
fir.typeRef.coneType.asKtType()
|
||||
}
|
||||
}
|
||||
is FirVariableAssignment -> {
|
||||
if (expression is KtUnaryExpression && expression.operationToken in KtTokens.INCREMENT_AND_DECREMENT) {
|
||||
fir.rValue.typeRef.coneType.asKtType()
|
||||
} else {
|
||||
analysisSession.builtinTypes.UNIT
|
||||
}
|
||||
}
|
||||
is FirExpression -> fir.typeRef.coneType.asKtType()
|
||||
is FirNamedReference -> fir.getReferencedElementType(firResolveState).asKtType()
|
||||
is FirStatement -> with(analysisSession) { builtinTypes.UNIT }
|
||||
|
||||
+18
@@ -120,6 +120,24 @@ public class FirHLExpressionTypeTestGenerated extends AbstractFirHLExpressionTyp
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/nonExpression.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("plusAssign.kt")
|
||||
public void testPlusAssign() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/plusAssign.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("postfixDec.kt")
|
||||
public void testPostfixDec() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/postfixDec.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("prefixInc.kt")
|
||||
public void testPrefixInc() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/prefixInc.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("property.kt")
|
||||
public void testProperty() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user