Test fixes for 'New diagnostic error for ambiguous object expression type'

This commit is contained in:
Mikhael Bogdanov
2013-02-19 14:36:50 +04:00
parent 1662c5cb75
commit 029b2d9770
7 changed files with 88 additions and 56 deletions
@@ -6,12 +6,19 @@ inline fun <T> java.util.Enumeration<T>.iterator() = object: Iterator<T> {
override fun next() = nextElement()
}
fun <T : Any> T?.iterator() = object {
trait MyIterator<T> {
fun hasNext() : Boolean
fun next() : T
}
fun <T : Any> T?.iterator() = object : MyIterator<T> {
var hasNext = this@iterator != null
private set
fun hasNext() = hasNext
override fun hasNext() = hasNext
fun next() : T {
override fun next() : T {
if (hasNext) {
hasNext = false
return this@iterator!!
@@ -26,3 +33,4 @@ fun main(args : Array<String>) {
System.out.println(x)
}
}