KT-8394 ReplaceWith for Delegates.lazy fails outside of stdlib

#KT-8394 Fixed
This commit is contained in:
Valentin Kipyatkov
2015-07-10 21:53:02 +03:00
parent 1346d98bf3
commit d32ba08cb7
20 changed files with 199 additions and 90 deletions
@@ -33,9 +33,6 @@ public interface ClassDescriptorWithResolutionScopes extends ClassDescriptor {
@NotNull
JetScope getScopeForInitializerResolution();
@NotNull
JetScope getScopeForMemberLookup();
@Nullable
@Override
ClassDescriptorWithResolutionScopes getCompanionObjectDescriptor();
@@ -51,7 +51,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
// This scope contains type parameters but does not contain inner classes
private final WritableScope scopeForSupertypeResolution;
private JetScope scopeForInitializers; //contains members + primary constructor value parameters + map for backing fields
private final JetScope scopeForMemberLookup;
private final JetScope unsubstitutedMemberScope;
private final JetScope staticScope = new StaticScopeForKotlinClass(this);
public MutableClassDescriptor(
@@ -70,7 +70,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
RedeclarationHandler redeclarationHandler = RedeclarationHandler.DO_NOTHING;
this.scopeForMemberLookup = new WritableScopeImpl(JetScope.Empty.INSTANCE$, this, redeclarationHandler, "MemberLookup", null, this)
this.unsubstitutedMemberScope = new WritableScopeImpl(JetScope.Empty.INSTANCE$, this, redeclarationHandler, "MemberLookup", null, this)
.changeLockLevel(WritableScope.LockLevel.BOTH);
this.scopeForSupertypeResolution = new WritableScopeImpl(outerScope, this, redeclarationHandler, "SupertypeResolution")
.changeLockLevel(WritableScope.LockLevel.BOTH);
@@ -256,8 +256,8 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
@Override
@NotNull
public JetScope getScopeForMemberLookup() {
return scopeForMemberLookup;
public JetScope getUnsubstitutedMemberScope() {
return unsubstitutedMemberScope;
}
@NotNull
@@ -61,7 +61,7 @@ public class DeclarationResolver {
public fun checkRedeclarations(c: TopDownAnalysisContext) {
for (classDescriptor in c.getDeclaredClasses().values()) {
val descriptorMap = HashMultimap.create<Name, DeclarationDescriptor>()
for (desc in classDescriptor.getScopeForMemberLookup().getOwnDeclaredDescriptors()) {
for (desc in classDescriptor.getUnsubstitutedMemberScope().getOwnDeclaredDescriptors()) {
if (desc is ClassDescriptor || desc is PropertyDescriptor) {
descriptorMap.put(desc.getName(), desc)
}
@@ -0,0 +1,68 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.resolve.lazy.descriptors
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.resolve.scopes.*
import org.jetbrains.kotlin.storage.StorageManager
class ClassResolutionScopesSupport(
private val classDescriptor: ClassDescriptor,
storageManager: StorageManager,
private val getOuterScope: () -> JetScope
) {
private val staticScope = StaticScopeForKotlinClass(classDescriptor)
private val scopeForClassHeaderResolution = storageManager.createLazyValue { computeScopeForClassHeaderResolution() }
private val scopeForMemberDeclarationResolution = storageManager.createLazyValue { computeScopeForMemberDeclarationResolution() }
fun getStaticScope(): JetScope = staticScope
fun getScopeForClassHeaderResolution(): JetScope = scopeForClassHeaderResolution()
fun getScopeForMemberDeclarationResolution(): JetScope = scopeForMemberDeclarationResolution()
private fun computeScopeForClassHeaderResolution(): JetScope {
val scope = WritableScopeImpl(JetScope.Empty, classDescriptor, RedeclarationHandler.DO_NOTHING, "Scope with type parameters for " + classDescriptor.getName())
for (typeParameterDescriptor in classDescriptor.getTypeConstructor().getParameters()) {
scope.addClassifierDescriptor(typeParameterDescriptor)
}
scope.changeLockLevel(WritableScope.LockLevel.READING)
return ChainedScope(classDescriptor, "ScopeForClassHeaderResolution: " + classDescriptor.getName(), scope, getOuterScope())
}
private fun computeScopeForMemberDeclarationResolution(): JetScope {
val thisScope = WritableScopeImpl(JetScope.Empty, classDescriptor, RedeclarationHandler.DO_NOTHING,
"Scope with 'this' for " + classDescriptor.getName(), classDescriptor.getThisAsReceiverParameter(), classDescriptor)
thisScope.changeLockLevel(WritableScope.LockLevel.READING)
return ChainedScope(
classDescriptor,
"ScopeForMemberDeclarationResolution: " + classDescriptor.getName(),
thisScope,
classDescriptor.getUnsubstitutedMemberScope(),
getScopeForClassHeaderResolution(),
getCompanionObjectScope(),
classDescriptor.getStaticScope())
}
private fun getCompanionObjectScope(): JetScope {
val companionObjectDescriptor = classDescriptor.getCompanionObjectDescriptor()
return if ((companionObjectDescriptor != null)) CompanionObjectMixinScope(companionObjectDescriptor) else JetScope.Empty
}
}
@@ -87,15 +87,14 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
private final MemoizedFunctionToNotNull<JetObjectDeclaration, ClassDescriptor> extraCompanionObjectDescriptors;
private final LazyClassMemberScope unsubstitutedMemberScope;
private final JetScope staticScope = new StaticScopeForKotlinClass(this);
private final NotNullLazyValue<JetScope> scopeForClassHeaderResolution;
private final NotNullLazyValue<JetScope> scopeForMemberDeclarationResolution;
private final NotNullLazyValue<JetScope> scopeForPropertyInitializerResolution;
private final NullableLazyValue<Void> forceResolveAllContents;
private final boolean isCompanionObject;
private final ClassResolutionScopesSupport resolutionScopesSupport;
public LazyClassDescriptor(
@NotNull LazyClassContext c,
@NotNull DeclarationDescriptor containingDeclaration,
@@ -193,18 +192,6 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
return computeCompanionObjectDescriptor(companionObject);
}
});
this.scopeForClassHeaderResolution = storageManager.createLazyValue(new Function0<JetScope>() {
@Override
public JetScope invoke() {
return computeScopeForClassHeaderResolution();
}
});
this.scopeForMemberDeclarationResolution = storageManager.createLazyValue(new Function0<JetScope>() {
@Override
public JetScope invoke() {
return computeScopeForMemberDeclarationResolution();
}
});
this.scopeForPropertyInitializerResolution = storageManager.createLazyValue(new Function0<JetScope>() {
@Override
public JetScope invoke() {
@@ -218,6 +205,13 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
return null;
}
}, null);
this.resolutionScopesSupport = new ClassResolutionScopesSupport(this, storageManager, new Function0<JetScope>() {
@Override
public JetScope invoke() {
return getOuterScope();
}
});
}
// NOTE: Called from constructor!
@@ -231,25 +225,14 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
@NotNull
@Override
public JetScope getScopeForMemberLookup() {
public JetScope getUnsubstitutedMemberScope() {
return unsubstitutedMemberScope;
}
@Override
@NotNull
public JetScope getScopeForClassHeaderResolution() {
return scopeForClassHeaderResolution.invoke();
}
@NotNull
private JetScope computeScopeForClassHeaderResolution() {
WritableScopeImpl scope = new WritableScopeImpl(JetScope.Empty.INSTANCE$, this, RedeclarationHandler.DO_NOTHING, "Scope with type parameters for " + getName());
for (TypeParameterDescriptor typeParameterDescriptor : getTypeConstructor().getParameters()) {
scope.addClassifierDescriptor(typeParameterDescriptor);
}
scope.changeLockLevel(WritableScope.LockLevel.READING);
return new ChainedScope(this, "ScopeForClassHeaderResolution: " + getName(), scope, getOuterScope());
return resolutionScopesSupport.getScopeForClassHeaderResolution();
}
@NotNull
@@ -260,29 +243,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
@Override
@NotNull
public JetScope getScopeForMemberDeclarationResolution() {
return scopeForMemberDeclarationResolution.invoke();
}
@NotNull
private JetScope computeScopeForMemberDeclarationResolution() {
WritableScopeImpl thisScope = new WritableScopeImpl(JetScope.Empty.INSTANCE$, this, RedeclarationHandler.DO_NOTHING,
"Scope with 'this' for " + getName(), this.getThisAsReceiverParameter(), this);
thisScope.changeLockLevel(WritableScope.LockLevel.READING);
return new ChainedScope(
this,
"ScopeForMemberDeclarationResolution: " + getName(),
thisScope,
getScopeForMemberLookup(),
getScopeForClassHeaderResolution(),
getCompanionObjectScope(),
getStaticScope()
);
}
private JetScope getCompanionObjectScope() {
ClassDescriptor companionObjectDescriptor = getCompanionObjectDescriptor();
return (companionObjectDescriptor != null) ? new CompanionObjectMixinScope(companionObjectDescriptor) : JetScope.Empty.INSTANCE$;
return resolutionScopesSupport.getScopeForMemberDeclarationResolution();
}
@Override
@@ -331,7 +292,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
@NotNull
@Override
public JetScope getStaticScope() {
return staticScope;
return resolutionScopesSupport.getStaticScope();
}
@NotNull
@@ -388,7 +349,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
}
Name name = ((JetClassOrObjectInfo) companionObjectInfo).getName();
assert name != null;
getScopeForMemberLookup().getClassifier(name);
getUnsubstitutedMemberScope().getClassifier(name);
ClassDescriptor companionObjectDescriptor = c.getTrace().get(BindingContext.CLASS, companionObject);
if (companionObjectDescriptor instanceof LazyClassDescriptor) {
assert DescriptorUtils.isCompanionObject(companionObjectDescriptor) : "Not a companion object: " + companionObjectDescriptor;
@@ -481,7 +442,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
ForceResolveUtil.forceResolveAllContents(getConstructors());
ForceResolveUtil.forceResolveAllContents(getDescriptorsForExtraCompanionObjects());
ForceResolveUtil.forceResolveAllContents(getScopeForMemberLookup());
ForceResolveUtil.forceResolveAllContents(getUnsubstitutedMemberScope());
ForceResolveUtil.forceResolveAllContents(getTypeConstructor());
}
@@ -503,7 +464,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
getOriginal();
getScopeForClassHeaderResolution();
getScopeForMemberDeclarationResolution();
getScopeForMemberLookup().getAllDescriptors();
getUnsubstitutedMemberScope().getAllDescriptors();
getScopeForInitializerResolution();
getUnsubstitutedInnerClassesScope();
getTypeConstructor().getSupertypes();
@@ -54,8 +54,8 @@ public class LazyScriptClassDescriptor extends LazyClassDescriptor {
@NotNull
@Override
public LazyScriptClassMemberScope getScopeForMemberLookup() {
return (LazyScriptClassMemberScope) super.getScopeForMemberLookup();
public LazyScriptClassMemberScope getUnsubstitutedMemberScope() {
return (LazyScriptClassMemberScope) super.getUnsubstitutedMemberScope();
}
@NotNull
@@ -65,7 +65,7 @@ public class LazyScriptDescriptor(
override fun getClassDescriptor() = resolveSession.getClassDescriptorForScript(jetScript) as LazyScriptClassDescriptor
override fun getScriptResultProperty(): PropertyDescriptor = getClassDescriptor().getScopeForMemberLookup().getScriptResultProperty()
override fun getScriptResultProperty(): PropertyDescriptor = getClassDescriptor().getUnsubstitutedMemberScope().getScriptResultProperty()
private val scriptCodeDescriptor = resolveSession.getStorageManager().createLazyValue {
val result = ScriptCodeDescriptor(this)
@@ -77,10 +77,10 @@ class LazyJavaClassDescriptor(
private val typeConstructor = c.storageManager.createLazyValue { LazyJavaClassTypeConstructor() }
override fun getTypeConstructor(): TypeConstructor = typeConstructor()
private val scopeForMemberLookup = LazyJavaClassMemberScope(c, this, jClass)
override fun getScopeForMemberLookup() = scopeForMemberLookup
private val unsubstitutedMemberScope = LazyJavaClassMemberScope(c, this, jClass)
override fun getUnsubstitutedMemberScope() = unsubstitutedMemberScope
private val innerClassesScope = InnerClassesScopeWrapper(getScopeForMemberLookup())
private val innerClassesScope = InnerClassesScopeWrapper(getUnsubstitutedMemberScope())
override fun getUnsubstitutedInnerClassesScope(): JetScope = innerClassesScope
private val staticScope = LazyJavaStaticClassScope(c, jClass, this)
@@ -90,14 +90,14 @@ class LazyJavaClassDescriptor(
override fun getCompanionObjectDescriptor(): ClassDescriptor? = null
override fun getConstructors() = scopeForMemberLookup.constructors()
override fun getConstructors() = unsubstitutedMemberScope.constructors()
private val annotations = c.storageManager.createLazyValue { c.resolveAnnotations(jClass) }
override fun getAnnotations() = annotations()
private val functionTypeForSamInterface = c.storageManager.createNullableLazyValue {
c.samConversionResolver.resolveFunctionTypeIfSamInterface(this) { method ->
scopeForMemberLookup.resolveMethodToFunctionDescriptor(method, false)
unsubstitutedMemberScope.resolveMethodToFunctionDescriptor(method, false)
}
}
@@ -71,7 +71,7 @@ public class FunctionClassDescriptor(
override fun getTypeConstructor(): TypeConstructor = typeConstructor
override fun getScopeForMemberLookup() = memberScope
override fun getUnsubstitutedMemberScope() = memberScope
override fun getCompanionObjectDescriptor() = null
override fun getConstructors() = emptyList<ConstructorDescriptor>()
@@ -31,6 +31,9 @@ public interface ClassDescriptor extends ClassifierDescriptor, MemberDescriptor,
@NotNull
JetScope getMemberScope(@NotNull List<? extends TypeProjection> typeArguments);
@NotNull
JetScope getUnsubstitutedMemberScope();
@NotNull
JetScope getUnsubstitutedInnerClassesScope();
@@ -41,13 +41,13 @@ public abstract class AbstractClassDescriptor implements ClassDescriptor {
this.defaultType = storageManager.createLazyValue(new Function0<JetType>() {
@Override
public JetType invoke() {
return TypeUtils.makeUnsubstitutedType(AbstractClassDescriptor.this, getScopeForMemberLookup());
return TypeUtils.makeUnsubstitutedType(AbstractClassDescriptor.this, getUnsubstitutedMemberScope());
}
});
this.unsubstitutedInnerClassesScope = storageManager.createLazyValue(new Function0<JetScope>() {
@Override
public JetScope invoke() {
return new InnerClassesScopeWrapper(getScopeForMemberLookup());
return new InnerClassesScopeWrapper(getUnsubstitutedMemberScope());
}
});
this.thisAsReceiverParameter = storageManager.createLazyValue(new Function0<ReceiverParameterDescriptor>() {
@@ -70,9 +70,6 @@ public abstract class AbstractClassDescriptor implements ClassDescriptor {
return this;
}
@NotNull
protected abstract JetScope getScopeForMemberLookup();
@NotNull
@Override
public JetScope getUnsubstitutedInnerClassesScope() {
@@ -91,13 +88,13 @@ public abstract class AbstractClassDescriptor implements ClassDescriptor {
assert typeArguments.size() == getTypeConstructor().getParameters().size() : "Illegal number of type arguments: expected "
+ getTypeConstructor().getParameters().size() + " but was " + typeArguments.size()
+ " for " + getTypeConstructor() + " " + getTypeConstructor().getParameters();
if (typeArguments.isEmpty()) return getScopeForMemberLookup();
if (typeArguments.isEmpty()) return getUnsubstitutedMemberScope();
List<TypeParameterDescriptor> typeParameters = getTypeConstructor().getParameters();
Map<TypeConstructor, TypeProjection> substitutionContext = TypeSubstitutor.buildSubstitutionContext(typeParameters, typeArguments);
TypeSubstitutor substitutor = TypeSubstitutor.create(substitutionContext);
return new SubstitutingScope(getScopeForMemberLookup(), substitutor);
return new SubstitutingScope(getUnsubstitutedMemberScope(), substitutor);
}
@NotNull
@@ -37,7 +37,7 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
private final TypeConstructor typeConstructor;
private final JetScope staticScope = new StaticScopeForKotlinClass(this);
private JetScope scopeForMemberLookup;
private JetScope unsubstitutedMemberScope;
private Set<ConstructorDescriptor> constructors;
private ConstructorDescriptor primaryConstructor;
@@ -56,11 +56,11 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
}
public final void initialize(
@NotNull JetScope scopeForMemberLookup,
@NotNull JetScope unsubstitutedMemberScope,
@NotNull Set<ConstructorDescriptor> constructors,
@Nullable ConstructorDescriptor primaryConstructor
) {
this.scopeForMemberLookup = scopeForMemberLookup;
this.unsubstitutedMemberScope = unsubstitutedMemberScope;
this.constructors = constructors;
this.primaryConstructor = primaryConstructor;
}
@@ -89,8 +89,8 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
@NotNull
@Override
protected JetScope getScopeForMemberLookup() {
return scopeForMemberLookup;
public JetScope getUnsubstitutedMemberScope() {
return unsubstitutedMemberScope;
}
@NotNull
@@ -91,7 +91,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
@NotNull
@Override
protected JetScope getScopeForMemberLookup() {
public JetScope getUnsubstitutedMemberScope() {
return scope;
}
@@ -97,6 +97,16 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
return new SubstitutingScope(memberScope, getSubstitutor());
}
@NotNull
@Override
public JetScope getUnsubstitutedMemberScope() {
JetScope memberScope = original.getUnsubstitutedMemberScope();
if (originalSubstitutor.isEmpty()) {
return memberScope;
}
return new SubstitutingScope(memberScope, getSubstitutor());
}
@NotNull
@Override
public JetScope getStaticScope() {
@@ -91,7 +91,7 @@ public class DeserializedClassDescriptor(
override fun getAnnotations() = annotations
override fun getScopeForMemberLookup() = memberScope
override fun getUnsubstitutedMemberScope() = memberScope
override fun getStaticScope() = staticScope
@@ -77,7 +77,7 @@ private class MissingDependencyErrorClassDescriptor(
override fun substitute(substitutor: TypeSubstitutor) = this
override fun getScopeForMemberLookup() = scope
override fun getUnsubstitutedMemberScope() = scope
override fun getMemberScope(typeArguments: List<TypeProjection?>) = scope
}
@@ -42,11 +42,11 @@ import org.jetbrains.kotlin.resolve.FunctionDescriptorUtil
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension
import org.jetbrains.kotlin.resolve.descriptorUtil.module
import org.jetbrains.kotlin.resolve.lazy.descriptors.ClassResolutionScopesSupport
import org.jetbrains.kotlin.resolve.scopes.*
import org.jetbrains.kotlin.resolve.scopes.receivers.ThisReceiver
import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.utils.addIfNotNull
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
import java.util.ArrayList
import java.util.LinkedHashSet
@@ -172,13 +172,18 @@ object ReplaceWithAnnotationAnalyzer {
is ClassDescriptorWithResolutionScopes ->
descriptor.getScopeForMemberDeclarationResolution()
is ClassDescriptor -> {
val outerScope = getResolutionScope(descriptor.getContainingDeclaration())
ClassResolutionScopesSupport(descriptor, LockBasedStorageManager.NO_LOCKS, { outerScope }).getScopeForMemberDeclarationResolution()
}
is FunctionDescriptor ->
FunctionDescriptorUtil.getFunctionInnerScope(getResolutionScope(descriptor.getContainingDeclaration()),
descriptor, RedeclarationHandler.DO_NOTHING)
is PropertyDescriptor ->
JetScopeUtils.getPropertyDeclarationInnerScope(descriptor,
getResolutionScope(descriptor.getContainingDeclaration()!!),
getResolutionScope(descriptor.getContainingDeclaration()),
RedeclarationHandler.DO_NOTHING)
is LocalVariableDescriptor -> {
val declaration = DescriptorToSourceUtils.descriptorToDeclaration(descriptor) as JetDeclaration
@@ -0,0 +1,7 @@
// "Replace with 'matches(input)'" "true"
import kotlin.text.Regex
fun foo(regex: Regex) {
regex.<caret>hasMatch("")
}
@@ -0,0 +1,7 @@
// "Replace with 'matches(input)'" "true"
import kotlin.text.Regex
fun foo(regex: Regex) {
regex.<caret>matches("")
}
@@ -0,0 +1,54 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.idea.quickfix;
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.TestDataPath
import org.jetbrains.kotlin.idea.test.JetLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.test.JetWithJdkAndRuntimeLightProjectDescriptor
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
import org.jetbrains.kotlin.idea.util.application.runWriteAction
import org.jetbrains.kotlin.psi.JetSimpleNameExpression
import org.jetbrains.kotlin.psi.psiUtil.parents
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners
import org.jetbrains.kotlin.test.JetTestUtils
import org.jetbrains.kotlin.test.TestMetadata
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
import org.junit.runner.RunWith
TestMetadata("idea/testData/quickfix.special")
TestDataPath("\$PROJECT_ROOT")
RunWith(JUnit3RunnerWithInners::class)
public class QuickFixSpecialTest : JetLightCodeInsightFixtureTestCase() {
override fun getTestDataPath() = JetTestUtils.getHomeDirectory()
override fun getProjectDescriptor() = JetWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
TestMetadata("deprecatedMemberInCompiledClass.kt")
public fun testDeprecatedMemberInCompiledClass() {
val testPath = JetTestUtils.navigationMetadata("idea/testData/quickfix.special/deprecatedMemberInCompiledClass.kt")
myFixture.configureByFile(testPath)
val offset = getEditor().getCaretModel().getOffset()
val element = getFile().findElementAt(offset)
val nameExpression = element!!.parents.firstIsInstance<JetSimpleNameExpression>()
getProject().executeWriteCommand("") {
DeprecatedSymbolUsageFix(nameExpression, ReplaceWith("matches(input)")).invoke(getProject(), getEditor(), getFile())
}
myFixture.checkResultByFile("$testPath.after")
}
}