Don't ask for member scope for ILT in IterableTypesDetection

EA-206183 fixed
This commit is contained in:
Dmitriy Novozhilov
2019-09-12 12:26:08 +03:00
parent 7472c789c6
commit 68bcdaa6c3
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.psi.KtPsiFactory
import org.jetbrains.kotlin.resolve.BindingTraceContext
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
import org.jetbrains.kotlin.resolve.constants.IntegerLiteralTypeConstructor
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
import org.jetbrains.kotlin.resolve.scopes.utils.collectFunctions
@@ -87,6 +88,7 @@ class IterableTypesDetection(
}
private fun canBeIterable(type: FuzzyType): Boolean {
if (type.type.constructor is IntegerLiteralTypeConstructor) return false
return type.type.memberScope.getContributedFunctions(iteratorName, NoLookupLocation.FROM_IDE).isNotEmpty() ||
typesWithExtensionIterator.any {
val freeParams = it.arguments.mapNotNull { it.type.constructor.declarationDescriptor as? TypeParameterDescriptor }