Don't resolve reference if result is useless

This commit is contained in:
Nikolay Krasko
2016-12-05 20:25:31 +03:00
parent 7a019e80fe
commit ee1ce184f9
@@ -804,9 +804,9 @@ fun ExtractableCodeDescriptor.validate(target: ExtractionTarget = ExtractionTarg
object : KtTreeVisitorVoid() {
override fun visitUserType(userType: KtUserType) {
val refExpr = userType.referenceExpression ?: return
val declaration = refExpr.mainReference.resolve() as? PsiNamedElement ?: return
val diagnostics = bindingContext.diagnostics.forElement(refExpr)
diagnostics.firstOrNull { it.factory == Errors.INVISIBLE_REFERENCE }?.let {
val declaration = refExpr.mainReference.resolve() as? PsiNamedElement ?: return
conflicts.putValue(declaration, getDeclarationMessage(declaration, "0.will.become.invisible.after.extraction"))
}
}