Iterate Intention: Filter out functions without 'operator' modifier

This commit is contained in:
Alexey Sedunov
2015-12-17 21:09:46 +03:00
parent 1c74bab1cc
commit 1d3054e7a6
4 changed files with 33 additions and 2 deletions
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeUtils
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext
import org.jetbrains.kotlin.types.expressions.ForLoopConventionsChecker
import org.jetbrains.kotlin.util.isValidOperator
import java.util.*
public class IterableTypesDetection(
@@ -49,8 +50,8 @@ public class IterableTypesDetection(
private val typesWithExtensionIterator: Collection<KotlinType> = scope
.collectFunctions(iteratorName, NoLookupLocation.FROM_IDE)
.mapNotNull { it.extensionReceiverParameter }
.map { it.type }
.filter { it.isValidOperator() }
.mapNotNull { it.extensionReceiverParameter?.type }
override fun isIterable(type: FuzzyType, loopVarType: KotlinType?): Boolean {
val elementType = elementType(type) ?: return false