Skip to content

Commit

Permalink
Fix test propertyFieldType()
Browse files Browse the repository at this point in the history
  • Loading branch information
kunli2 committed Oct 27, 2023
1 parent 2a66cd0 commit 81dffa1
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2916,7 +2916,7 @@ public J visitSimpleNameExpression(KtSimpleNameExpression expression, ExecutionC
// TODO: The FIR does not have a PSI element associated to names, similarly name references from the PSI are not linked to the IR.
// The type must be added in context to the parent element.
// I.E. IrConstructor assocaited to the KtPrimaryConstructor.
return createIdentifier(expression, type(expression));
return createIdentifier(expression, type(expression), variableType(expression));
}

@Override
Expand Down Expand Up @@ -3279,6 +3279,12 @@ private JavaType.Variable variableType(PsiElement psi) {
if (basedSymbol instanceof FirVariableSymbol) {
return (JavaType.Variable) psiElementAssociations.getTypeMapping().type(basedSymbol.getFir(), owner(psi));
}
} else if (psi instanceof KtNameReferenceExpression) {
FirBasedSymbol<?> basedSymbol = psiElementAssociations.symbol((KtNameReferenceExpression) psi);
if (basedSymbol instanceof FirVariableSymbol) {
return (JavaType.Variable) psiElementAssociations.getTypeMapping().type(basedSymbol.getFir(), owner(psi));
}

}
return null;
}
Expand Down

0 comments on commit 81dffa1

Please sign in to comment.