Support creating flexible types in tests

Flexible types can not be created in normal user code, but if there's a special classifier `kotlin.internal.flexible.ft` with two type parameters,
its occurrences are replaced by flexible types, e.g. `ft<Int, Int?>` becomes `Int!`
This commit is contained in:
Andrey Breslav
2014-10-16 19:19:10 +04:00
parent 8067a9ad56
commit f06e5581aa
20 changed files with 220 additions and 11 deletions
@@ -0,0 +1,8 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !EXPLICIT_FLEXIBLE_TYPES
// !CHECK_TYPE
fun foo(f: ft<Int, Int?>) {
f.checkType { it : _<Int> }
f.checkType { it : _<Int?> }
}
@@ -0,0 +1,11 @@
package
internal fun foo(/*0*/ f: kotlin.Int!): kotlin.Unit
internal fun </*0*/ T> T.checkType(/*0*/ f: (_<T>) -> kotlin.Unit): (_<T>) -> kotlin.Unit
internal final class _</*0*/ T> {
public constructor _</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,9 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !EXPLICIT_FLEXIBLE_TYPES
// !CHECK_TYPE
package ppp
fun foo(f: ft<Int, Int?>) {
f.checkType { it : _<Int> }
f.checkType { it : _<Int?> }
}
@@ -0,0 +1,13 @@
package
package ppp {
internal fun foo(/*0*/ f: kotlin.Int!): kotlin.Unit
internal fun </*0*/ T> T.checkType(/*0*/ f: (ppp._<T>) -> kotlin.Unit): (ppp._<T>) -> kotlin.Unit
internal final class _</*0*/ T> {
public constructor _</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}