Fixed ReplaceWith quickfix not working when synthetic extensions are used in the pattern

This commit is contained in:
Valentin Kipyatkov
2015-09-01 15:51:19 +03:00
parent 16650e8f5c
commit 37ed77467f
8 changed files with 46 additions and 22 deletions
@@ -114,7 +114,7 @@ public class ReplInterpreter {
FileScopeProvider.AdditionalScopes scopeProvider = new FileScopeProvider.AdditionalScopes() {
@NotNull
@Override
public List<JetScope> scopes(@NotNull JetFile file) {
public List<JetScope> getScopes() {
return lastLineScope != null ? new SmartList<JetScope>(lastLineScope) : Collections.<JetScope>emptyList();
}
};
@@ -16,12 +16,9 @@
package org.jetbrains.kotlin.synthetic
import org.jetbrains.kotlin.psi.JetFile
import org.jetbrains.kotlin.resolve.lazy.FileScopeProvider
import org.jetbrains.kotlin.storage.StorageManager
class AdditionalScopesWithJavaSyntheticExtensions(storageManager: StorageManager) : FileScopeProvider.AdditionalScopes {
private val scopes = listOf(JavaSyntheticPropertiesScope(storageManager), SamAdapterFunctionsScope(storageManager))
override fun scopes(file: JetFile) = scopes
override val scopes = listOf(JavaSyntheticPropertiesScope(storageManager), SamAdapterFunctionsScope(storageManager))
}
@@ -29,7 +29,7 @@ public interface FileScopeProvider {
}
public interface AdditionalScopes {
public fun scopes(file: JetFile): List<JetScope>
public val scopes: List<JetScope>
}
}
@@ -80,7 +80,7 @@ public class FileScopeProviderImpl(
scopeChain.add(LazyImportScope(packageFragment, allUnderImportResolver, LazyImportScope.FilteringKind.VISIBLE_CLASSES, "All under imports in $debugName (visible classes)"))
scopeChain.add(LazyImportScope(packageFragment, defaultAllUnderImportResolver, LazyImportScope.FilteringKind.VISIBLE_CLASSES, "Default all under imports in $debugName (visible classes)"))
scopeChain.addAll(additionalScopes.flatMap { it.scopes(file) })
scopeChain.addAll(additionalScopes.flatMap { it.scopes })
scopeChain.add(LazyImportScope(packageFragment, allUnderImportResolver, LazyImportScope.FilteringKind.INVISIBLE_CLASSES, "All under imports in $debugName (invisible classes only)"))
scopeChain.add(LazyImportScope(packageFragment, defaultAllUnderImportResolver, LazyImportScope.FilteringKind.INVISIBLE_CLASSES, "Default all under imports in $debugName (invisible classes only)"))