Test fixes for 'New diagnostic error for ambiguous object expression type'
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user