[FIR] Reorder scopes for KT-34822

This commit is contained in:
Nikolay Lunyak
2021-09-28 15:06:28 +03:00
parent 1d2c1140a4
commit e5d5e5be44
7 changed files with 40 additions and 26 deletions
@@ -1,32 +1,42 @@
FILE: typeParameterVsNested.kt
public abstract interface Some : R|kotlin/Any| {
public open fun test(): R|kotlin/Int| {
^test Int(10)
}
}
public abstract class My<T : R|test/Some|> : R|kotlin/Any| {
public constructor<T : R|test/Some|>(): R|test/My<T>| {
super<R|kotlin/Any|>()
}
public final inner class T<T : R|test/Some|> : R|kotlin/Any| {
public test/My<T>.constructor(): R|test/My.T<T>| {
public open class T : R|kotlin/Any| {
public constructor(): R|test/My.T| {
super<R|kotlin/Any|>()
}
}
public abstract val x: R|test/My.T<T>|
public get(): R|test/My.T<T>|
public abstract val x: R|T|
public get(): R|T|
public abstract fun foo(arg: R|test/My.T<T>|): R|kotlin/Unit|
public final fun foo(arg: R|T|): R|kotlin/Int| {
^foo R|<local>/arg|.R|test/Some.test|().R|kotlin/Int.plus|(this@R|test/My|.R|test/My.x|.R|test/Some.test|())
}
public abstract val y: <ERROR TYPE REF: Wrong number of type arguments>
public get(): <ERROR TYPE REF: Wrong number of type arguments>
public abstract val y: R|test/My.T|
public get(): R|test/My.T|
public abstract val z: <ERROR TYPE REF: Wrong number of type arguments>
public get(): <ERROR TYPE REF: Wrong number of type arguments>
public abstract val z: R|test/My.T|
public get(): R|test/My.T|
public final class Some : <ERROR TYPE REF: Type parameter T cannot be a supertype> {
public final fun boo(): R|kotlin/String| {
^boo this@R|test/My|.R|test/My.y|.<Unresolved name: test>#().R|kotlin/plus|(this@R|test/My|.R|test/My.z|.<Unresolved name: test>#())
}
public final class Some : R|test/My.T| {
public constructor(): R|test/My.Some| {
super<R|test/My.T<T>|>()
super<R|T|>()
}
}
@@ -1,19 +1,25 @@
package test
interface Some
interface Some {
fun test() = 10
}
abstract class My<T : Some> {
inner class T
open class T
abstract val x: T
abstract fun foo(arg: T)
// Wouldn't work for the inner class T
fun foo(arg: T) = arg.test() + x.test()
abstract val y: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>My<!>.T
abstract val y: My.T
abstract val z: test.<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>My<!>.T
abstract val z: test.My.T
class Some : <!SUPERTYPE_NOT_A_CLASS_OR_INTERFACE, UNRESOLVED_REFERENCE!>T<!>()
// Would work for the type parameter T
fun boo() = y.<!UNRESOLVED_REFERENCE!>test<!>() + z.<!UNRESOLVED_REFERENCE!>test<!>()
class Some : T()
}
abstract class Your<T : Some> : <!SUPERTYPE_NOT_A_CLASS_OR_INTERFACE!>T<!>