diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/IteratorAmbiguity.jet b/compiler/testData/diagnostics/tests/operatorsOverloading/IteratorAmbiguity.jet new file mode 100644 index 00000000000..b9d90ddbb5f --- /dev/null +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/IteratorAmbiguity.jet @@ -0,0 +1,27 @@ +//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.iterator() + for (val element in collection) { + } +} \ No newline at end of file