Refine type arguments resolution and rendering
In case of type constructors captured parameters from outer classes #KT-5510 Fixed #KT-3112 Fixed #KT-6325 Fixed #KT-408 Fixed #KT-6337 Fixed
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
import java.util.*
|
||||
|
||||
class A<T> : AbstractCollection<T>() {
|
||||
override fun iterator(): MyIt = MyIt()
|
||||
|
||||
override val size: Int
|
||||
get() = 1
|
||||
|
||||
inner class MyIt : MutableIterator<T> {
|
||||
override fun next(): T {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun hasNext(): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun remove() {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun <E> commonSupertype(x: E, y: E): E = x
|
||||
|
||||
fun foo() {
|
||||
var myIt = A<String>().iterator()
|
||||
myIt = <!TYPE_MISMATCH!>A<Int>().iterator()<!>
|
||||
|
||||
val csIt: Iterator<CharSequence> = A<String>().iterator()
|
||||
|
||||
commonSupertype(A<String>().iterator(), A<Int>().iterator()).checkType { _<A<out Any>.MyIt>() }
|
||||
}
|
||||
Reference in New Issue
Block a user