K2: Add some more tests showing the state for KT-64840
lambdaParameterForBareTypeEarlyFixationAffectsBehavior.kt should show in the future commits how early variable fixation necessary for bare type information might affect inference results ^KT-64840 Related
This commit is contained in:
committed by
Space Team
parent
a56dc7d73a
commit
141be17b4b
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// ISSUE: KT-64840
|
||||
class Controller<T> {
|
||||
fun yield(t: T): Boolean = true
|
||||
}
|
||||
|
||||
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
interface A<F> {
|
||||
val a: F
|
||||
}
|
||||
|
||||
interface B<G> : A<G> {
|
||||
val b: G
|
||||
}
|
||||
|
||||
fun <X> withCallback(x: X, c: Controller<in X>, p: (X) -> Unit) {}
|
||||
|
||||
fun main(a: A<String>) {
|
||||
val x = generate {
|
||||
withCallback(a, this) {
|
||||
(it as <!NO_TYPE_ARGUMENTS_ON_RHS!>B<!>).<!UNRESOLVED_REFERENCE!>b<!>.length
|
||||
it.<!UNRESOLVED_REFERENCE!>b<!>.length
|
||||
it.a.length
|
||||
}
|
||||
}
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("A<kotlin.String>")!>x<!>
|
||||
}
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// ISSUE: KT-64840
|
||||
class Controller<T> {
|
||||
fun yield(t: T): Boolean = true
|
||||
}
|
||||
|
||||
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
interface A<F> {
|
||||
val a: F
|
||||
}
|
||||
|
||||
interface B<G> : A<G> {
|
||||
val b: G
|
||||
}
|
||||
|
||||
fun <X> withCallback(x: X, c: Controller<in X>, p: (X) -> Unit) {}
|
||||
|
||||
fun main(a: A<String>) {
|
||||
val x = generate {
|
||||
withCallback(a, this) {
|
||||
(it as B).b.length
|
||||
<!DEBUG_INFO_SMARTCAST!>it<!>.b.length
|
||||
it.a.length
|
||||
}
|
||||
}
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("A<kotlin.String>")!>x<!>
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// !CHECK_TYPE
|
||||
// ISSUE: KT-64840
|
||||
|
||||
class Controller<T> {
|
||||
fun yield(t: T): Boolean = true
|
||||
}
|
||||
|
||||
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
interface CommonSupertype
|
||||
interface A<F> : CommonSupertype
|
||||
interface B<G> : A<G>
|
||||
interface C : CommonSupertype
|
||||
|
||||
fun <X> predicate(x: X, c: Controller<X>, p: (X) -> Unit) {}
|
||||
|
||||
fun main(a: A<*>, c: C) {
|
||||
val x1 = generate {
|
||||
predicate(a, this) { x ->
|
||||
// x is B
|
||||
}
|
||||
|
||||
yield(c)
|
||||
}
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CommonSupertype")!>x1<!>
|
||||
|
||||
val x2 = generate {
|
||||
predicate(a, this) { x ->
|
||||
x is <!NO_TYPE_ARGUMENTS_ON_RHS!>B<!>
|
||||
}
|
||||
|
||||
yield(c)
|
||||
}
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CommonSupertype")!>x2<!>
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// !CHECK_TYPE
|
||||
// ISSUE: KT-64840
|
||||
|
||||
class Controller<T> {
|
||||
fun yield(t: T): Boolean = true
|
||||
}
|
||||
|
||||
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
interface CommonSupertype
|
||||
interface A<F> : CommonSupertype
|
||||
interface B<G> : A<G>
|
||||
interface C : CommonSupertype
|
||||
|
||||
fun <X> predicate(x: X, c: Controller<X>, p: (X) -> Unit) {}
|
||||
|
||||
fun main(a: A<*>, c: C) {
|
||||
val x1 = generate {
|
||||
predicate(a, this) { x ->
|
||||
// x is B
|
||||
}
|
||||
|
||||
yield(c)
|
||||
}
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CommonSupertype")!>x1<!>
|
||||
|
||||
val x2 = generate {
|
||||
predicate(a, this) { x ->
|
||||
<!USELESS_IS_CHECK!>x is <!NO_TYPE_ARGUMENTS_ON_RHS!>B<!><!>
|
||||
}
|
||||
|
||||
yield(c)
|
||||
}
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CommonSupertype")!>x2<!>
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// ISSUE: KT-64840
|
||||
class Controller<T> {
|
||||
val t: T get() = TODO()
|
||||
fun yield(t: T): Boolean = true
|
||||
}
|
||||
|
||||
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
interface A<F> {
|
||||
val a: F?
|
||||
}
|
||||
|
||||
interface B<G> : A<G>
|
||||
|
||||
fun main(a: A<*>) {
|
||||
generate {
|
||||
yield(a)
|
||||
t is <!NO_TYPE_ARGUMENTS_ON_RHS!>B<!>
|
||||
}.a
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// ISSUE: KT-64840
|
||||
class Controller<T> {
|
||||
val t: T get() = TODO()
|
||||
fun yield(t: T): Boolean = true
|
||||
}
|
||||
|
||||
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
interface A<F> {
|
||||
val a: F?
|
||||
}
|
||||
|
||||
interface B<G> : A<G>
|
||||
|
||||
fun main(a: A<*>) {
|
||||
generate {
|
||||
yield(a)
|
||||
<!USELESS_IS_CHECK!>t is <!NO_TYPE_ARGUMENTS_ON_RHS!>B<!><!>
|
||||
}.a
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// ISSUE: KT-64840
|
||||
|
||||
class Controller<T> {
|
||||
fun yield(t: T): Boolean = true
|
||||
}
|
||||
|
||||
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
interface CommonSupertype
|
||||
interface A<F> : CommonSupertype
|
||||
interface B : A<String>
|
||||
interface C : CommonSupertype
|
||||
|
||||
fun <X> predicate(x: X, c: Controller<X>, p: (X) -> Boolean) {}
|
||||
|
||||
fun main(a: A<String>, c: C) {
|
||||
val x2 = generate {
|
||||
predicate(a, this) { x ->
|
||||
// USELESS_IS_CHECK is errorenously reported in K1
|
||||
x is B
|
||||
}
|
||||
|
||||
yield(c)
|
||||
}
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CommonSupertype")!>x2<!>
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// ISSUE: KT-64840
|
||||
|
||||
class Controller<T> {
|
||||
fun yield(t: T): Boolean = true
|
||||
}
|
||||
|
||||
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
interface CommonSupertype
|
||||
interface A<F> : CommonSupertype
|
||||
interface B : A<String>
|
||||
interface C : CommonSupertype
|
||||
|
||||
fun <X> predicate(x: X, c: Controller<X>, p: (X) -> Boolean) {}
|
||||
|
||||
fun main(a: A<String>, c: C) {
|
||||
val x2 = generate {
|
||||
predicate(a, this) { x ->
|
||||
// USELESS_IS_CHECK is errorenously reported in K1
|
||||
<!USELESS_IS_CHECK!>x is B<!>
|
||||
}
|
||||
|
||||
yield(c)
|
||||
}
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CommonSupertype")!>x2<!>
|
||||
}
|
||||
Reference in New Issue
Block a user