From ee1ce184f9c36b3ccff6e23bc940c3b64d56783d Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Mon, 5 Dec 2016 20:25:31 +0300 Subject: [PATCH] Don't resolve reference if result is useless --- .../introduce/extractionEngine/extractableAnalysisUtil.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractableAnalysisUtil.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractableAnalysisUtil.kt index d3aa9950998..31b91ff9dbb 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractableAnalysisUtil.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractableAnalysisUtil.kt @@ -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")) } }