From 5c32f5f0e78596fc25815a692a592c3a4c379a47 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Wed, 18 Apr 2012 22:04:28 +0400 Subject: [PATCH] KT-1821 Write test for ITERATOR_AMBIGUITY diagnostic #KT-1821 fixed --- .../IteratorAmbiguity.jet | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/operatorsOverloading/IteratorAmbiguity.jet 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