This commit is contained in:
Valentin Kipyatkov
2015-01-16 23:00:11 +03:00
parent eae244c308
commit 8f688ab7b7
@@ -42,7 +42,7 @@ public class IterableTypesDetector(
private val cache = HashMap<JetType, Boolean>() private val cache = HashMap<JetType, Boolean>()
private val iteratorName = Name.identifier("iterator") private val iteratorName = Name.identifier("iterator")
private val typesWithIteratorExtensions: Collection<JetType> = scope.getFunctions(iteratorName) private val typesWithExtensionIterator: Collection<JetType> = scope.getFunctions(iteratorName)
.map { it.getExtensionReceiverParameter() } .map { it.getExtensionReceiverParameter() }
.filterNotNull() .filterNotNull()
.map { it.getType() } .map { it.getType() }
@@ -64,6 +64,6 @@ public class IterableTypesDetector(
} }
private fun canBeIterable(type: JetType): Boolean { private fun canBeIterable(type: JetType): Boolean {
return type.getMemberScope().getFunctions(iteratorName).isEmpty() || typesWithIteratorExtensions.any { type.isSubtypeOf(type) } return type.getMemberScope().getFunctions(iteratorName).isEmpty() || typesWithExtensionIterator.any { type.isSubtypeOf(type) }
} }
} }