Do subtyping with stub types properly

1) Return stub type if we are calculating super type between two same stub types
2) Return nullable Any if those stub types are different
This commit is contained in:
Victor Petukhov
2021-04-27 14:05:35 +03:00
parent 5d0461c722
commit ac7b459f2a
49 changed files with 1536 additions and 75 deletions
@@ -2,14 +2,8 @@ package
public val test1: kotlin.collections.List<kotlin.Int>
public val test2: kotlin.collections.List<kotlin.Int>
public val test3: [ERROR : Type for generate {
yield(3)
yieldBarReturnType(3)
}]
public val test4: [ERROR : Type for generate {
yield(3)
barReturnType()
}]
public val test3: kotlin.collections.List<kotlin.Int>
public val test4: kotlin.collections.List<kotlin.Int>
public fun </*0*/ S> generate(/*0*/ @kotlin.BuilderInference g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public final class GenericController</*0*/ T> {
@@ -1,8 +1,6 @@
package
public val extension: [ERROR : Type for build {
extensionAdd("foo")
}]
public val extension: kotlin.collections.List<kotlin.String>
public val member: kotlin.collections.List<kotlin.Int>
public val memberWithoutAnn: [ERROR : Type for wrongBuild {
add(42)
@@ -1,8 +1,6 @@
package
public val extension: [ERROR : Type for build {
extensionAdd("foo")
}]
public val extension: kotlin.collections.List<kotlin.String>
public val member: kotlin.collections.List<kotlin.Int>
public val memberWithoutAnn: [ERROR : Type for wrongBuild {
add(42)
@@ -1,8 +1,6 @@
package
public val extension: [ERROR : Type for generate {
extensionYield("foo")
}]
public val extension: kotlin.collections.List<kotlin.String>
public val normal: kotlin.collections.List<kotlin.Int>
public val safeExtension: kotlin.collections.List<kotlin.String>
public fun </*0*/ S> generate(/*0*/ @kotlin.BuilderInference g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
@@ -83,11 +83,11 @@ fun test() {
this@a.<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>yield2<!>(1)
with(this) {
yield("")
this@with.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, DEBUG_INFO_UNRESOLVED_WITH_TARGET, UNRESOLVED_REFERENCE!>yield<!>("")
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>yield<!>("")
this@with.<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>yield<!>("")
yield2("")
this@with.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>yield2<!>("")
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>yield2<!>("")
this@with.<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>yield2<!>("")
}
}
}
@@ -75,5 +75,5 @@ fun test() {
}
// TODO: FIR
// {AbstractAssert<*, out Any!>! & EnumerableAssert<*, {Comparable<*> & java.io.Serializable!}>!} with unfolded flexible nullability
<!DEBUG_INFO_EXPRESSION_TYPE("({AbstractAssert<*, out (kotlin.Any..kotlin.Any?)> & EnumerableAssert<*, out ({Comparable<*> & java.io.Serializable}..{Comparable<*>? & java.io.Serializable?})>}..{AbstractAssert<*, out (kotlin.Any..kotlin.Any?)>? & EnumerableAssert<*, out ({Comparable<*> & java.io.Serializable}..{Comparable<*>? & java.io.Serializable?})>?})")!>assertion<!>
<!DEBUG_INFO_EXPRESSION_TYPE("({AbstractAssert<*, out (Any..Any?)> & EnumerableAssert<*, out ({Comparable<*> & java.io.Serializable}..{Comparable<*>? & java.io.Serializable?})>}..{AbstractAssert<*, out (Any..Any?)>? & EnumerableAssert<*, out ({Comparable<*> & java.io.Serializable}..{Comparable<*>? & java.io.Serializable?})>?})")!>assertion<!>
}