Add multiplatform test with substitution, fix deep supertypes
This commit fixes ambiguity problems introduced before in MPP tests with deep supertypes #KT-29636 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
0e3fecf614
commit
bd769f8fd7
@@ -0,0 +1,10 @@
|
||||
expect open class A<T>() {
|
||||
open fun foo(arg: T)
|
||||
}
|
||||
open class B : A<String>() {
|
||||
// Fake: override fun foo(arg: String) = super.foo(arg)
|
||||
// Fake (JVM only) (?): override fun bar(arg: String): String = super.bar(arg)
|
||||
}
|
||||
open class C : B() {
|
||||
open fun bar(arg: CharSequence): String = arg.toString()
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
FILE: common.kt
|
||||
<T> public open expect class A {
|
||||
public constructor(): super<R|kotlin/Any|>()
|
||||
|
||||
public open function foo(arg: R|T|): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public open class B : R|A<kotlin/String>| {
|
||||
public constructor(): super<R|A<kotlin/String>|>()
|
||||
|
||||
}
|
||||
public open class C : R|B| {
|
||||
public constructor(): super<R|B|>()
|
||||
|
||||
public open function bar(arg: R|kotlin/CharSequence|): R|kotlin/String| {
|
||||
return@@@bar <Unresolved name: arg>#.<Unresolved name: toString>#()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
actual open class A<T> {
|
||||
actual open fun foo(arg: T) {}
|
||||
open fun bar(arg: T): T = arg
|
||||
}
|
||||
class D : C() {
|
||||
// Fake: override fun bar(arg: CharSequence): String = super.bar(arg)
|
||||
fun test() {
|
||||
foo("")
|
||||
bar("")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
FILE: jvm.kt
|
||||
<T> public open actual class A {
|
||||
public constructor(): super<R|kotlin/Any|>()
|
||||
|
||||
public open actual function foo(arg: R|T|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public open function bar(arg: R|T|): R|T| {
|
||||
return@@@bar <Unresolved name: arg>#
|
||||
}
|
||||
|
||||
}
|
||||
public final class D : R|C| {
|
||||
public constructor(): super<R|C|>()
|
||||
|
||||
public final function test(): R|kotlin/Unit| {
|
||||
R|FakeOverride</A.foo>|(String())
|
||||
R|FakeOverride</A.bar>|(String())
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -13,8 +13,8 @@ FILE: jvm.kt
|
||||
public constructor(): super<R|B|>()
|
||||
|
||||
public final function test(): R|kotlin/Unit| {
|
||||
<Ambiguity: foo, [/A.foo, /A.foo]>#()
|
||||
<Ambiguity: bar, [/A.bar, /A.bar]>#()
|
||||
R|/A.foo|()
|
||||
R|/A.bar|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@ FILE: jvm.kt
|
||||
public constructor(): super<R|B|>()
|
||||
|
||||
public final function test(): R|kotlin/Unit| {
|
||||
<Ambiguity: foo, [/A.foo, /A.foo]>#()
|
||||
R|/A.foo|()
|
||||
<Unresolved name: bar>#()
|
||||
<Unresolved name: baz>#()
|
||||
}
|
||||
@@ -33,8 +33,8 @@ FILE: jvm.kt
|
||||
|
||||
public final function test(): R|kotlin/Unit| {
|
||||
R|/A.foo|()
|
||||
<Ambiguity: bar, [/X.bar, /X.bar]>#()
|
||||
<Ambiguity: baz, [/Y.baz, /Y.baz]>#()
|
||||
R|/X.bar|()
|
||||
R|/Y.baz|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user