K2: Fix bounds erasure for raw types
Basically, this commit reworks eraseToUpperBound* stuff Instead of a bunch of vague flags, we introduce two modes (rawTypes/intersection emptiness checker) which defined those flags. Also, it makes choosing `eraseArgumentsDeeply` option always because that how it works in K1 and also use invariant projection inside `eraseArgumentsDeeply` for raw types for the same reason. ^KT-57198 Fixed
This commit is contained in:
committed by
Space Team
parent
b0de442d76
commit
38138bf079
Vendored
+1
-1
@@ -8,5 +8,5 @@ public class Foo<P1 extends Boo<P2, P3, P4>, P2 extends Boo<P1, P3, P4>, P3 exte
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
val x = <!DEBUG_INFO_EXPRESSION_TYPE("Foo<Boo<*>..Boo<*>?!, Boo<*>..Boo<*>?!, Boo<*>..Boo<*>?!, Boo<*>..Boo<*>?!>..Foo<*, *, *, *>?!")!>Foo.test1()<!>
|
||||
val x = <!DEBUG_INFO_EXPRESSION_TYPE("Foo<Boo<Boo<*>..Boo<*>?!>..Boo<Boo<*>..Boo<*>?!>?!, Boo<*>..Boo<*>?!, Boo<Boo<Boo<*>..Boo<*>?!>..Boo<Boo<*>..Boo<*>?!>?!>..Boo<Boo<Boo<*>..Boo<*>?!>..Boo<Boo<*>..Boo<*>?!>?!>?!, Boo<Boo<Boo<*>..Boo<*>?!>..Boo<Boo<*>..Boo<*>?!>?!>..Boo<Boo<Boo<*>..Boo<*>?!>..Boo<Boo<*>..Boo<*>?!>?!>?!>..Foo<*, *, *, *>?!")!>Foo.test1()<!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,5 +8,5 @@ class Foo<P1 : Boo<P2, P3, P4>, P2 : Boo<P1, P3, P4>, P3 : Boo<P1, P2, P4>, P4 :
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
val x = <!DEBUG_INFO_EXPRESSION_TYPE("Foo<Boo<*, *, *>, Boo<*, *, *>, Boo<*, *, *>, Boo<*, *, *>>..Foo<*, *, *, *>?!")!>Boo.test1()<!>
|
||||
val x = <!DEBUG_INFO_EXPRESSION_TYPE("Foo<Boo<Boo<*, Boo<*, *, Boo<*, *, *>>, Boo<*, *, *>>, Boo<*, *, Boo<*, *, *>>, Boo<*, *, *>>, Boo<*, Boo<*, *, Boo<*, *, *>>, Boo<*, *, *>>, Boo<*, *, Boo<*, *, *>>, Boo<*, *, *>>..Foo<*, *, *, *>?!")!>Boo.test1()<!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ public class Foo<T extends Boo<K>, K extends Boo<X>, X extends Boo<K>> {
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
val x = <!DEBUG_INFO_EXPRESSION_TYPE("Foo<Boo<*>..Boo<*>?!, Boo<*>..Boo<*>?!, Boo<*>..Boo<*>?!>..Foo<*, *, *>?!")!>Foo.test1()<!>.test2()
|
||||
val x = <!DEBUG_INFO_EXPRESSION_TYPE("Foo<Boo<Boo<Boo<*>..Boo<*>?!>..Boo<Boo<*>..Boo<*>?!>?!>..Boo<Boo<Boo<*>..Boo<*>?!>..Boo<Boo<*>..Boo<*>?!>?!>?!, Boo<Boo<*>..Boo<*>?!>..Boo<Boo<*>..Boo<*>?!>?!, Boo<*>..Boo<*>?!>..Foo<*, *, *>?!")!>Foo.test1()<!>.test2()
|
||||
}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-57198
|
||||
// FILE: CustomGdbServerRunConfiguration.java
|
||||
|
||||
public class CustomGdbServerRunConfiguration implements CidrRunConfiguration {}
|
||||
|
||||
// FILE: main.kt
|
||||
interface CidrBuildTarget<BC>
|
||||
interface CidrRunConfiguration<BC, TARGET: CidrBuildTarget<BC>>
|
||||
|
||||
fun applyEditorTo(arg: CidrRunConfiguration<Any?, CidrBuildTarget<Any?>>) {}
|
||||
|
||||
fun main() {
|
||||
// Previously, for CidrRunConfiguration raw type, it's lower bound was resolved as CidrRunConfiguration<Any?, CidrBuildTarget<*>> in K2
|
||||
// That is not a subtype of CidrRunConfiguration<Any?, CidrBuildTarget<Any?>>
|
||||
applyEditorTo(CustomGdbServerRunConfiguration()) // K1: ok, K2: was ARGUMENT_TYPE_MISMATCH
|
||||
}
|
||||
Reference in New Issue
Block a user