Fix "operator modifier required" errors in project

This commit is contained in:
Yan Zhulanow
2015-11-24 18:15:08 +03:00
parent 46ac3571d5
commit 87799e9b6b
18 changed files with 25 additions and 25 deletions
@@ -220,7 +220,7 @@ public class ReifiedTypeParameterMappings() {
mappingsByName[name] = ReifiedTypeParameterMapping(name, type = null, asmType = null, newName = newName, signature = null)
}
fun get(name: String): ReifiedTypeParameterMapping? {
operator fun get(name: String): ReifiedTypeParameterMapping? {
return mappingsByName[name]
}
}
@@ -51,7 +51,7 @@ public class JvmDependenciesIndex(_roots: List<JavaRoot>) {
private class Cache {
private val innerPackageCaches = HashMap<String, Cache>()
fun get(name: String) = innerPackageCaches.getOrPut(name) { Cache() }
operator fun get(name: String) = innerPackageCaches.getOrPut(name) { Cache() }
// indices of roots that are known to contain this package
// if this list contains [1, 3, 5] then roots with indices 1, 3 and 5 are known to contain this package, 2 and 4 are known not to (no information about roots 6 or higher)
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.psi.psiUtil.getChildrenOfType
data class PositionalAndNamedArguments(val positional: List<ValueArgument>, val named: List<ValueArgument>)
{
fun get(position: Int, name: String): ValueArgument? =
operator fun get(position: Int, name: String): ValueArgument? =
positional.getOrNull(position) ?: named.find { it.getArgumentName()!!.asName.asString() == name }
}
@@ -40,6 +40,6 @@ public fun StorageComponentContainer.useInstance(instance: Any) {
registerInstance(instance)
}
public inline fun <reified T : Any> ComponentProvider.get(thisRef: Any?, desc: PropertyMetadata): T {
inline operator fun <reified T : Any> ComponentProvider.getValue(thisRef: Any?, desc: PropertyMetadata): T {
return getService(javaClass<T>())
}
@@ -314,7 +314,7 @@ public fun PsiElement.getTextWithLocation(): String = "'${this.getText()}' at ${
// -----------------------------------------------------------------------------------------------------------------------------------------
public fun SearchScope.contains(element: PsiElement): Boolean = PsiSearchScopeUtil.isInScope(this, element)
operator fun SearchScope.contains(element: PsiElement): Boolean = PsiSearchScopeUtil.isInScope(this, element)
public fun <E : PsiElement> E.createSmartPointer(): SmartPsiElementPointer<E> =
SmartPointerManager.getInstance(getProject()).createSmartPsiElementPointer(this)
@@ -96,7 +96,7 @@ abstract class WritableScopeStorage(val redeclarationHandler: RedeclarationHandl
private fun Int.descriptorByIndex() = addedDescriptors[this]
private fun IntList?.plus(value: Int) = IntList(value, this)
private operator fun IntList?.plus(value: Int) = IntList(value, this)
private fun <TDescriptor: DeclarationDescriptor> IntList.toDescriptors(): List<TDescriptor> {
val result = ArrayList<TDescriptor>(1)
@@ -60,7 +60,7 @@ public class KtLightClassForFacade private constructor(
{ CachedValueProvider.Result.create(FacadeCacheData(), PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT) },
/*trackValue = */ false)
public fun get(qualifiedName: FqName, searchScope: GlobalSearchScope): CachedValue<KotlinFacadeLightClassData> {
public operator fun get(qualifiedName: FqName, searchScope: GlobalSearchScope): CachedValue<KotlinFacadeLightClassData> {
synchronized (cachedValue) {
return cachedValue.getValue().cache.get(StubCacheKey(qualifiedName, searchScope))
}
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.tests.di
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.container.StorageComponentContainer
import org.jetbrains.kotlin.container.createContainer
import org.jetbrains.kotlin.container.get
import org.jetbrains.kotlin.container.getValue
import org.jetbrains.kotlin.container.useImpl
import org.jetbrains.kotlin.context.ModuleContext
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
@@ -43,7 +43,7 @@ public class ReflectionTypes(private val module: ModuleDescriptor) {
}
private object ClassLookup {
fun getValue(types: ReflectionTypes, property: PropertyMetadata): ClassDescriptor {
operator fun getValue(types: ReflectionTypes, property: PropertyMetadata): ClassDescriptor {
return types.find(property.name.capitalize())
}
}
@@ -30,7 +30,7 @@ public abstract class TypeSubstitution {
}
}
public abstract fun get(key: KotlinType): TypeProjection?
public abstract operator fun get(key: KotlinType): TypeProjection?
public open fun isEmpty(): Boolean = false
@@ -32,6 +32,6 @@ public interface NullableLazyValue<T : Any> : Function0<T?> {
public fun isComputed(): Boolean
}
public fun <T : Any> NotNullLazyValue<T>.getValue(_this: Any?, p: PropertyMetadata): T = invoke()
public operator fun <T : Any> NotNullLazyValue<T>.getValue(_this: Any?, p: PropertyMetadata): T = invoke()
public fun <T : Any> NullableLazyValue<T>.getValue(_this: Any?, p: PropertyMetadata): T? = invoke()
public operator fun <T : Any> NullableLazyValue<T>.getValue(_this: Any?, p: PropertyMetadata): T? = invoke()
@@ -45,7 +45,7 @@ class ClsStubBuilderComponents(
}
interface TypeParameters {
fun get(id: Int): Name
operator fun get(id: Int): Name
fun child(nameResolver: NameResolver, innerTypeParameters: List<ProtoBuf.TypeParameter>)
= TypeParametersImpl(nameResolver, innerTypeParameters, parent = this)
@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
import java.util.*
internal fun KotlinType.contains(inner: KotlinType): Boolean {
internal operator fun KotlinType.contains(inner: KotlinType): Boolean {
return KotlinTypeChecker.DEFAULT.equalTypes(this, inner) || getArguments().any { inner in it.getType() }
}
@@ -55,7 +55,7 @@ public interface KotlinPsiRange {
val empty: Boolean get() = this is Empty
fun contains(element: PsiElement): Boolean = getTextRange().contains(element.getTextRange() ?: TextRange.EMPTY_RANGE)
operator fun contains(element: PsiElement): Boolean = getTextRange().contains(element.getTextRange() ?: TextRange.EMPTY_RANGE)
fun match(scope: PsiElement, unifier: KotlinPsiUnifier): List<UnificationResult.Matched> {
val elements = elements.filter(SIGNIFICANT_FILTER)
@@ -164,7 +164,7 @@ class CodeBuilder(private val topElement: PsiElement?, private var docConverter:
}
private data class Prefix(val elements: List<PsiElement>, val lineBreaksBefore: Int) {
fun plus(other: Prefix): Prefix {
operator fun plus(other: Prefix): Prefix {
return when {
isEmpty() -> other
other.isEmpty() -> this
@@ -59,7 +59,7 @@ class Annotations(val annotations: List<Annotation>) : Element() {
override val isEmpty: Boolean
get() = annotations.isEmpty()
fun plus(other: Annotations) = Annotations(annotations + other.annotations).assignNoPrototype()
operator fun plus(other: Annotations) = Annotations(annotations + other.annotations).assignNoPrototype()
companion object {
val Empty = Annotations(listOf())
@@ -373,10 +373,10 @@ public class IncrementalCacheImpl(
return CompilationResult(protoChanged = diff != DifferenceKind.NONE, changes = changes)
}
public fun contains(className: JvmClassName): Boolean =
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
public fun get(className: JvmClassName): ProtoMapValue? =
operator fun get(className: JvmClassName): ProtoMapValue? =
storage[className.internalName]
public fun remove(className: JvmClassName) {
@@ -405,7 +405,7 @@ public class IncrementalCacheImpl(
return if (result.isEmpty()) null else result
}
fun contains(className: JvmClassName): Boolean =
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
public fun process(kotlinClass: LocalFileKotlinClass): CompilationResult {
@@ -572,7 +572,7 @@ public class IncrementalCacheImpl(
storage.append(sourceFile.absolutePath, { out -> IOUtil.writeUTF(out, className.internalName) })
}
public fun get(sourceFile: File): Collection<JvmClassName> =
public operator fun get(sourceFile: File): Collection<JvmClassName> =
storage[sourceFile.absolutePath].orEmpty().map { JvmClassName.byInternalName(it) }
override fun dumpValue(value: List<String>) = value.toString()
@@ -633,7 +633,7 @@ public class IncrementalCacheImpl(
}
}
public fun get(sourcePath: String, jvmSignature: String): Collection<String> {
public operator fun get(sourcePath: String, jvmSignature: String): Collection<String> {
val key = PathFunctionPair(sourcePath, jvmSignature)
return storage[key] ?: emptySet()
}
@@ -674,7 +674,7 @@ data class CompilationResult(
public val NO_CHANGES: CompilationResult = CompilationResult()
}
public fun plus(other: CompilationResult): CompilationResult =
public operator fun plus(other: CompilationResult): CompilationResult =
CompilationResult(protoChanged || other.protoChanged,
constantsChanged || other.constantsChanged,
inlineChanged || other.inlineChanged,
@@ -88,13 +88,13 @@ public class FunctionReader(private val context: TranslationContext) {
readFunction(descriptor).sure { "Could not read function: $descriptor" }
}
public fun contains(descriptor: CallableDescriptor): Boolean {
operator fun contains(descriptor: CallableDescriptor): Boolean {
val moduleName = getExternalModuleName(descriptor)
val currentModuleName = context.getConfig().getModuleId()
return currentModuleName != moduleName && moduleName != null && moduleName in moduleJsDefinition
}
public fun get(descriptor: CallableDescriptor): JsFunction = functionCache.get(descriptor)
operator fun get(descriptor: CallableDescriptor): JsFunction = functionCache.get(descriptor)
private fun readFunction(descriptor: CallableDescriptor): JsFunction? {
if (descriptor !in this) return null