Files
kotlin-fork/compiler/testData/diagnostics/tests/operatorsOverloading/IteratorAmbiguity.kt
T
Svetlana Isakova c739632c57 report 'ambiguity' on reference, not on the whole expression
as other type inference errors
2013-09-03 13:09:15 +04:00

27 lines
591 B
Kotlin

//KT-1821 Write test for ITERATOR_AMBIGUITY diagnostic
trait MyCollectionInterface {
}
trait MyAnotherCollectionInterface {
}
class MyCollection : MyCollectionInterface, MyAnotherCollectionInterface {
}
fun MyCollectionInterface.iterator() = MyIterator()
fun MyAnotherCollectionInterface.iterator() = MyIterator()
class MyIterator {
fun next() : MyElement = MyElement()
fun hasNext() = true
}
class MyElement
fun test1(collection: MyCollection) {
collection.<!OVERLOAD_RESOLUTION_AMBIGUITY!>iterator<!>()
for (element in <!ITERATOR_AMBIGUITY!>collection<!>) {
}
}